{"record":{"id":"eb48ed731722833a","repo":"moeru-ai/airi","slug":"provider-definition-with-id-definitionid-not","errorCode":null,"errorMessage":"Provider definition with id \"${definitionId}\" not found.","messagePattern":"Provider definition with id \"(.+?)\" not found\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/stage-ui/src/services/inference-service-providers.ts","lineNumber":103,"sourceCode":" * Use when:\n * - Wiring controller stores to provider domain operations.\n * - Tests need to replace the whole service surface with one mock object.\n *\n * Expects:\n * - No runtime dependencies are required yet.\n *\n * Returns:\n * - A stable object containing provider domain operations.\n */\nexport function createInferenceServiceProvidersService(): InferenceServiceProvidersService {\n  function requestOptions(options?: InferenceServiceProviderServiceOptions): RequestOptions | undefined {\n    return options?.abortSignal ? { init: { signal: options.abortSignal } } : undefined\n  }\n\n  function buildLocal(definitionId: string, initialConfig: Record<string, unknown> = {}): InferenceServiceProvider {\n    const definition = getDefinedProvider(definitionId)\n    if (!definition)\n      throw new Error(`Provider definition with id \"${definitionId}\" not found.`)\n\n    return {\n      id: nanoid(),\n      definitionId,\n      config: initialConfig,\n      status: 'unconfigured',\n    }\n  }\n\n  function normalize(value: unknown): InferenceServiceProvider {\n    const item = value as InferenceServiceProvider & {\n      validated: boolean\n      validationBypassed: boolean\n    }\n    let status: ProviderValidationStatus = 'unconfigured'\n    if (item.validated)\n      status = 'configured'\n    else if (item.validationBypassed)","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/moeru-ai/airi/blob/27111382b4a79a7e983289d6e983a06af185ed0f/packages/stage-ui/src/services/inference-service-providers.ts#L85-L121","documentation":"Thrown by InferenceServiceProvidersService.buildLocal when getDefinedProvider(definitionId) returns undefined. buildLocal constructs a local provider instance keyed by a registered definition; if the definitionId is not in the provider registry, it cannot create a valid provider and fails fast. This is a configuration/integrity error, not a network error.","triggerScenarios":"Calling buildLocal('some-id') where 'some-id' is not among the registered provider definitions (typo, removed provider, or a persisted config referencing a definition that no longer exists after an upgrade). Also when a dynamic/legacy definitionId was never registered in the current build.","commonSituations":"Persisted provider config in localStorage/DB referencing a definitionId that was renamed or removed in a newer app version; typo in a hardcoded definitionId; provider module not imported so its defineProvider never ran; feature-flagged provider disabled at build time.","solutions":["Verify the definitionId against the list returned by getDefinedProvider / the provider registry; correct typos or update to the current id.","When loading persisted providers, drop or migrate entries whose definitionId is no longer registered rather than calling buildLocal on them.","Ensure the provider module that registers the definition is imported in the current build.","Add a fallback that maps legacy ids to current ones during migration."],"exampleFix":"// before\nconst definition = getDefinedProvider(definitionId)\nif (!definition)\n  throw new Error(`Provider definition with id \"${definitionId}\" not found.`)\n\n// caller-side: validate before building\nif (!getDefinedProvider(id)) {\n  console.warn(`Skipping unregistered provider definition: ${id}`)\n  return null\n}\nreturn buildLocal(id, config)","handlingStrategy":"type-guard","validationCode":"import { getDefinedProvider } from '../../libs/providers/providers'\n\nfunction isRegisteredDefinitionId(id: string): boolean {\n  return !!getDefinedProvider(id)\n}\n\n// before building\nif (!isRegisteredDefinitionId(definitionId)) {\n  // migrate/drop stale persisted entry, or prompt user to reconfigure\n  return null\n}\nreturn buildLocal(definitionId, config)","typeGuard":"function isRegisteredProviderDefinition(definitionId: string): boolean {\n  return !!getDefinedProvider(definitionId)\n}","tryCatchPattern":"try {\n  return buildLocal(definitionId, config)\n}\ncatch (error) {\n  if (String(error).includes('Provider definition with id')) {\n    // drop or migrate the stale persisted config\n    removePersistedProvider(definitionId)\n    return null\n  }\n  throw error\n}","preventionTips":["When loading persisted providers, filter out entries whose definitionId is no longer registered instead of calling buildLocal on them.","Keep a legacy-id-to-current-id migration map across provider renames.","Ensure all provider modules that register definitions are imported in the current build."],"tags":["validation","config","providers","registry","migration"],"backgroundTag":null,"analyzedSha":"27111382b4a79a7e983289d6e983a06af185ed0f","analyzedAt":"2026-08-12T18:33:34.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}