DTK0017: Dock Not Registered
Package:
@vitejs/devtools
Message
Dock with id "
{id}" is not registered. Use register() to add new docks.
Cause
This error is thrown by DevToolsDockHost.update() when you attempt to update a dock entry whose id does not exist in the dock host's registry. The update() method on the host (not the one returned from register()) checks that the dock is already registered before applying changes.
This can happen when:
- You call
context.docks.update()directly with an id that was never registered. - The dock was previously removed or was never successfully registered.
- There is a typo in the dock id.
Example
ts
// In a plugin's devtools.setup() hook
export default function myPlugin(): Plugin {
return {
name: 'my-plugin',
devtools: {
setup(context) {
// Attempting to update a dock that doesn't exist throws DTK0017
context.docks.update({
id: 'my-plugin:nonexistent',
type: 'iframe',
title: 'Ghost Panel',
icon: 'ph:ghost-duotone',
category: 'debug',
src: '/.my-plugin/',
})
},
},
}
}Fix
Register the dock before updating it. Use context.docks.register() for initial registration, then use the returned update handle for subsequent changes:
ts
// Register first
const dock = context.docks.register({
id: 'my-plugin:overview',
type: 'iframe',
title: 'Overview',
icon: 'ph:eye-duotone',
category: 'analysis',
src: '/.my-plugin/',
})
// Then update via the returned handle
dock.update({ title: 'Updated Overview' })If you are unsure whether a dock is registered, you can check the dock host's views map before updating:
ts
if (context.docks.views.has('my-plugin:overview')) {
context.docks.update({
id: 'my-plugin:overview',
type: 'iframe',
title: 'Updated Overview',
icon: 'ph:eye-duotone',
category: 'analysis',
src: '/.my-plugin/',
})
}Source
packages/core/src/node/host-docks.ts