vuejs/vue-cli · error · Error
Widget definition ${definitionId} not found
Error message
Widget definition ${definitionId} not found What it means
The widgets connector keeps an in-memory map (widgetDefs) of registered widget definitions keyed by their `definition.id`, populated via registerDefinition. findDefinition({ definitionId }) looks up that map; if no definition was registered under the given id, it throws naming the missing definitionId.
Source
Thrown at packages/@vue/cli-ui/apollo-server/connectors/widgets.js:76
const plugins = require('./plugins')
const plugin = plugins.findOne({ id: definition.pluginId, file: cwd.get() }, context)
const logo = await plugins.getLogo(plugin, context)
if (logo) {
definition.icon = `${logo}?project=${project.id}`
}
}
widgetDefs.set(definition.id, definition)
}
function listDefinitions (context) {
return widgetDefs.values()
}
function findDefinition ({ definitionId }, context) {
const def = widgetDefs.get(definitionId)
if (!def) {
throw new Error(`Widget definition ${definitionId} not found`)
}
return def
}
async function list (context) {
log('loadPromise', loadPromise)
if (loadPromise) {
await loadPromise
}
log('widgets', widgets)
return widgets
}
function load (context) {
const projects = require('./projects')
const id = projects.getCurrent(context).id
const project = context.db.get('projects').find({ id }).value()
widgets = project.widgetsView on GitHub (pinned to 7eb93c169c)
Solutions
- Ensure the widget definition is registered (via registerDefinition/addDefinition) before any findDefinition call.
- Verify the definitionId spelling matches the registered `definition.id` exactly.
- If using the UI API, confirm the owning plugin is installed and enabled before requesting the widget.
Defensive patterns
Strategy: validation
Validate before calling
// before lookups, confirm registration; widgetDefs is module-internal,
// so gate on the public listDefinitions result
const registered = new Set([...listDefinitions(context)].map(d => d.id))
if (!registered.has(definitionId)) {
throw new Error(`Widget definition ${definitionId} not registered`)
} Type guard
const isRegisteredWidget = (id, context) => new Set([...listDefinitions(context)].map(d => d.id)).has(id)
Try / catch
try { findDefinition({ definitionId }, context) } catch (e) { /* fall back: skip widget, log unknown id */ } Prevention
- Register widget definitions (registerDefinition) before any findDefinition call.
- Match the requested definitionId to the registered definition.id exactly.
- After a reset/load cycle, re-verify registrations before lookups.
When it happens
Trigger: Calling a widget operation (findDefinition) with a definitionId that was never registered, was registered under a different id, or was removed by a reset/load cycle.
Common situations: Widget/plugin load ordering where the lookup runs before registration; a typo in the definitionId; referencing a widget id that the active plugin set does not provide.
Related errors
AI-assisted analysis of vuejs/vue-cli@7eb93c169c (2026-08-13).
Data as JSON: /api/errors/b6276b426bf81700.
Report an issue: GitHub.