{"record":{"id":"f3f061c558a630ae","repo":"nocobase/nocobase","slug":"llm-service-provider-not-found","errorCode":null,"errorMessage":"LLM service provider not found","messagePattern":"LLM service provider not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/plugins/@nocobase/plugin-ai/src/server/manager/ai-manager.ts","lineNumber":199,"sourceCode":"    }\n\n    if (reasoning) {\n      modelOptions._reasoning = reasoning;\n    }\n\n    const service = await this.plugin.db.getRepository('llmServices').findOne({\n      filter: {\n        name: llmService,\n      },\n    });\n\n    if (!service) {\n      throw new Error('LLM service not found');\n    }\n\n    const providerOptions = this.llmProviders.get(service.provider);\n    if (!providerOptions) {\n      throw new Error('LLM service provider not found');\n    }\n\n    if (webSearch === true && providerOptions.webSearchModels && !providerOptions.webSearchModels.includes(model)) {\n      throw new Error(`Web search is not supported by model \"${model}\"`);\n    }\n\n    const Provider = providerOptions.provider;\n    const provider = new Provider({\n      app: this.plugin.app,\n      serviceOptions: service.options,\n      modelOptions,\n    });\n\n    return { provider, model, service };\n  }\n}\n","sourceCodeStart":181,"sourceCodeEnd":216,"githubUrl":"https://github.com/nocobase/nocobase/blob/fa42722fefe44265490dff2c27d79e2882bce4fa/packages/plugins/@nocobase/plugin-ai/src/server/manager/ai-manager.ts#L181-L216","documentation":"After the llmServices row is found, getLLMService checks `this.llmProviders.get(service.provider)` — the registry populated by registerLLMProvider. If the row's `provider` value has no registered provider plugin, it throws 'LLM service provider not found'. The service record exists but its provider backend is not available in this server instance.","triggerScenarios":"A llmServices row whose `provider` string (e.g. 'openai', 'deepseek') was never registered via registerLLMProvider on this app — provider plugin not installed/enabled, plugin load order issue, or the row was copied from an environment with extra AI provider plugins.","commonSituations":"Migrating a database dump to an instance missing a commercial/pro AI provider plugin; disabling the provider plugin in plugin manager while its services remain in llmServices; typo in the provider column; provider registered under a different name after an upgrade.","solutions":["Install/enable the provider plugin that registers this provider name (check plugin manager or app.pm list).","Verify llmServices.provider matches a name passed to aiManager.registerLLMProvider (compare with listLLMProviders() output).","Remove or re-point orphaned llmServices rows whose provider no longer exists.","Ensure provider plugins initialize before AI features are used (check boot/load order and plugin errors in server logs)."],"exampleFix":"// before: llmServices row has provider 'deepseek' but the deepseek plugin is disabled\n// after: enable @nocobase/plugin-ai deepseek provider, or update the row\nawait app.db.getRepository('llmServices').update({ filter: { name: 'my-service' }, values: { provider: 'openai' } });","handlingStrategy":"validation","validationCode":"const providers = await aiManager.listLLMProviders();\nconst known = new Set(providers.map((p) => p.name));\nif (!known.has(service.provider)) throw new Error(`Provider \"${service.provider}\" is not installed/enabled on this instance`);","typeGuard":"function providerRegistered(name: string, providers: { name: string }[]): boolean {\n  return providers.some((p) => p.name === name);\n}","tryCatchPattern":"try {\n  const svc = await aiManager.getLLMService(opts);\n} catch (e) {\n  if (e.message === 'LLM service provider not found') {\n    // enable/install the provider plugin or clean up orphaned llmServices rows\n  }\n  throw e;\n}","preventionTips":["Keep provider plugin sets identical across environments you sync database data to.","Check listLLMProviders() after startup to confirm all expected providers registered.","Remove or disable llmServices rows whose provider plugin was uninstalled."],"tags":["plugins","llm","registry-miss"],"backgroundTag":"provider-not-registered","analyzedSha":"fa42722fefe44265490dff2c27d79e2882bce4fa","analyzedAt":"2026-09-01T00:54:31.202Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}