{"record":{"id":"60b05676274d6e0f","repo":"n8n-io/n8n","slug":"unsupported-provider-provider-supported-pro","errorCode":null,"errorMessage":"Unsupported provider: \"${provider}\". Supported providers: ${SUPPORTED_PROVIDERS}","messagePattern":"Unsupported provider: \"(.+?)\"\\. Supported providers: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@n8n/agents/src/runtime/model/model-factory.ts","lineNumber":239,"sourceCode":"\tif (isLanguageModel(config)) {\n\t\treturn config;\n\t}\n\n\tconst rawId = typeof config === 'string' ? config : config.id;\n\tif (!rawId || rawId.trim() === '') {\n\t\tthrow new Error('Model ID is required');\n\t}\n\n\tconst slashIndex = rawId.indexOf('/');\n\tif (slashIndex <= 0) {\n\t\tthrow new Error(`Invalid model ID \"${rawId}\": expected \"provider/model-name\" format`);\n\t}\n\tconst provider = rawId.slice(0, slashIndex) as ProviderId;\n\tconst modelName = rawId.slice(slashIndex + 1);\n\n\tconst entry = LANGUAGE_PROVIDERS[provider];\n\tif (!entry) {\n\t\tthrow new Error(\n\t\t\t`Unsupported provider: \"${provider}\". Supported providers: ${SUPPORTED_PROVIDERS}`,\n\t\t);\n\t}\n\n\t// Collect credential fields: strip `id`, pass the rest to Zod validation.\n\tlet credFields: Record<string, unknown> = {};\n\tif (typeof config !== 'string') {\n\t\tconst { id: _id, ...rest } = config as { id: string; [k: string]: unknown };\n\t\tcredFields = rest;\n\t}\n\t// Host configs (e.g. Instance AI's `{ id, url }` for OpenAI-compatible\n\t// endpoints) spell the base URL as `url`; the provider schemas only know\n\t// `baseURL`, and Zod strips unknown keys, so normalize before validation.\n\t// An EMPTY url means \"no custom endpoint\" (Instance AI emits `url: ''` for\n\t// the api-key-only config) and must keep the provider default.\n\tif (typeof credFields.url === 'string' && credFields.baseURL === undefined) {\n\t\tconst { url, ...restCreds } = credFields;\n\t\tcredFields = url ? { ...restCreds, baseURL: url } : restCreds;","sourceCodeStart":221,"sourceCodeEnd":257,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/agents/src/runtime/model/model-factory.ts#L221-L257","documentation":"After splitting the model ID at the first `/`, `createModel` looks up the provider segment in `LANGUAGE_PROVIDERS`. If the provider key is not in the registry it throws, listing all supported providers. The registry currently includes: `openai`, `custom`, `anthropic`, `google`, `google-vertex`, `mistral`, `cohere`, `microsoft-azure`, `aws-bedrock` (per the registry definition).","triggerScenarios":"Calling `createModel('huggingface/llama-3')` where `huggingface` is not a registered provider. Using a typo like `createModel('anthrpic/claude-sonnet-4-5')`. Using a provider alias that does not exist in the registry.","commonSituations":"Typo in the provider name. The desired provider's `@ai-sdk/*` package is not installed (though this error is about the registry key, not the package). A custom/self-hosted model endpoint was given a provider name not in the registry (should use `custom/` instead).","solutions":["Read the error message — it lists all supported provider keys.","Correct the provider segment to match a registered key exactly (e.g. `anthropic` not `anthrpic`).","For OpenAI-compatible custom endpoints, use the `custom/` provider prefix and supply `baseURL` and `apiKey` in the config.","If you need a genuinely new provider, add an entry to `LANGUAGE_PROVIDERS` in model-factory.ts and install the corresponding `@ai-sdk/*` package."],"exampleFix":"// before:\ncreateModel('anthrpic/claude-sonnet-4-5'); // typo\n\n// after:\ncreateModel('anthropic/claude-sonnet-4-5');","handlingStrategy":"validation","validationCode":"import { SUPPORTED_PROVIDERS } from './model-factory'; // export if needed\n\nconst KNOWN_PROVIDERS = new Set(['openai','custom','anthropic','google','google-vertex','mistral','cohere','microsoft-azure','aws-bedrock']);\n\nfunction validateProvider(modelId: string): void {\n  const provider = modelId.slice(0, modelId.indexOf('/'));\n  if (!KNOWN_PROVIDERS.has(provider)) {\n    throw new Error(`Unknown provider \"${provider}\". Known: ${[...KNOWN_PROVIDERS].join(', ')}`);\n  }\n}\n\nvalidateProvider(config.modelId);","typeGuard":"function isKnownProvider(modelId: string): boolean {\n  const provider = modelId.slice(0, modelId.indexOf('/'));\n  return ['openai','custom','anthropic','google','google-vertex','mistral','cohere','microsoft-azure','aws-bedrock'].includes(provider);\n}","tryCatchPattern":null,"preventionTips":["Keep an up-to-date list of supported providers in your config/UI validation.","For custom OpenAI-compatible endpoints, always use the `custom/` prefix.","Validate at config-load time so the user gets the error in the UI, not at runtime."],"tags":["model-config","validation","provider","registry"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}