nocobase/nocobase · error

LLM service provider not found

Error message

LLM service provider not found

What it means

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.

Source

Thrown at packages/plugins/@nocobase/plugin-ai/src/server/manager/ai-manager.ts:199

    }

    if (reasoning) {
      modelOptions._reasoning = reasoning;
    }

    const service = await this.plugin.db.getRepository('llmServices').findOne({
      filter: {
        name: llmService,
      },
    });

    if (!service) {
      throw new Error('LLM service not found');
    }

    const providerOptions = this.llmProviders.get(service.provider);
    if (!providerOptions) {
      throw new Error('LLM service provider not found');
    }

    if (webSearch === true && providerOptions.webSearchModels && !providerOptions.webSearchModels.includes(model)) {
      throw new Error(`Web search is not supported by model "${model}"`);
    }

    const Provider = providerOptions.provider;
    const provider = new Provider({
      app: this.plugin.app,
      serviceOptions: service.options,
      modelOptions,
    });

    return { provider, model, service };
  }
}

View on GitHub (pinned to fa42722fef)

Solutions

  1. Install/enable the provider plugin that registers this provider name (check plugin manager or app.pm list).
  2. Verify llmServices.provider matches a name passed to aiManager.registerLLMProvider (compare with listLLMProviders() output).
  3. Remove or re-point orphaned llmServices rows whose provider no longer exists.
  4. Ensure provider plugins initialize before AI features are used (check boot/load order and plugin errors in server logs).

Example fix

// before: llmServices row has provider 'deepseek' but the deepseek plugin is disabled
// after: enable @nocobase/plugin-ai deepseek provider, or update the row
await app.db.getRepository('llmServices').update({ filter: { name: 'my-service' }, values: { provider: 'openai' } });
Defensive patterns

Strategy: validation

Validate before calling

const providers = await aiManager.listLLMProviders();
const known = new Set(providers.map((p) => p.name));
if (!known.has(service.provider)) throw new Error(`Provider "${service.provider}" is not installed/enabled on this instance`);

Type guard

function providerRegistered(name: string, providers: { name: string }[]): boolean {
  return providers.some((p) => p.name === name);
}

Try / catch

try {
  const svc = await aiManager.getLLMService(opts);
} catch (e) {
  if (e.message === 'LLM service provider not found') {
    // enable/install the provider plugin or clean up orphaned llmServices rows
  }
  throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of nocobase/nocobase@fa42722fef (2026-09-01). Data as JSON: /api/errors/f3f061c558a630ae. Report an issue: GitHub.