{"record":{"id":"b6276b426bf81700","repo":"vuejs/vue-cli","slug":"widget-definition-definitionid-not-found","errorCode":null,"errorMessage":"Widget definition ${definitionId} not found","messagePattern":"Widget definition (.+?) not found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@vue/cli-ui/apollo-server/connectors/widgets.js","lineNumber":76,"sourceCode":"    const plugins = require('./plugins')\n    const plugin = plugins.findOne({ id: definition.pluginId, file: cwd.get() }, context)\n    const logo = await plugins.getLogo(plugin, context)\n    if (logo) {\n      definition.icon = `${logo}?project=${project.id}`\n    }\n  }\n\n  widgetDefs.set(definition.id, definition)\n}\n\nfunction listDefinitions (context) {\n  return widgetDefs.values()\n}\n\nfunction findDefinition ({ definitionId }, context) {\n  const def = widgetDefs.get(definitionId)\n  if (!def) {\n    throw new Error(`Widget definition ${definitionId} not found`)\n  }\n  return def\n}\n\nasync function list (context) {\n  log('loadPromise', loadPromise)\n  if (loadPromise) {\n    await loadPromise\n  }\n  log('widgets', widgets)\n  return widgets\n}\n\nfunction load (context) {\n  const projects = require('./projects')\n  const id = projects.getCurrent(context).id\n  const project = context.db.get('projects').find({ id }).value()\n  widgets = project.widgets","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/vuejs/vue-cli/blob/7eb93c169c7520935252e2473387f923ef80d856/packages/@vue/cli-ui/apollo-server/connectors/widgets.js#L58-L94","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// before lookups, confirm registration; widgetDefs is module-internal,\n// so gate on the public listDefinitions result\nconst registered = new Set([...listDefinitions(context)].map(d => d.id))\nif (!registered.has(definitionId)) {\n  throw new Error(`Widget definition ${definitionId} not registered`)\n}","typeGuard":"const isRegisteredWidget = (id, context) =>\n  new Set([...listDefinitions(context)].map(d => d.id)).has(id)","tryCatchPattern":"try { findDefinition({ definitionId }, context) } catch (e) { /* fall back: skip widget, log unknown id */ }","preventionTips":["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."],"tags":["cli-ui","widgets","lookup"],"backgroundTag":null,"analyzedSha":"7eb93c169c7520935252e2473387f923ef80d856","analyzedAt":"2026-08-13T10:13:37.803Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}