Skip to content

DTK0019: Terminal Session Not Registered

Package: @vitejs/devtools

Message

Terminal session with id "{id}" not registered

Cause

The DevToolsTerminalHost.update() method was called with a session id that does not exist in the terminal sessions map. You can only update sessions that were previously added via register() or startChildProcess().

Example

ts
export default defineDevToolsPlugin({
  name: 'my-plugin',
  setup(context) {
    // Trying to update a session that was never registered throws DTK0019
    context.terminals.update({
      id: 'my-plugin:nonexistent',
      label: 'Updated Label',
    })
  },
})

Fix

Register the terminal session before attempting to update it.

ts
// Register first
context.terminals.register({
  id: 'my-plugin:terminal',
  label: 'My Terminal',
  icon: 'i-carbon-terminal',
})

// Then update
context.terminals.update({
  id: 'my-plugin:terminal',
  label: 'Updated Label',
})

If the session may or may not exist, check the sessions map before updating:

ts
if (context.terminals.sessions.has('my-plugin:terminal')) {
  context.terminals.update({
    id: 'my-plugin:terminal',
    label: 'Updated Label',
  })
}

Source

packages/core/src/node/host-terminals.ts

Released under the MIT License.