Mintplex-Labs/anything-llm · error · Error
Unknown provider: ${config.provider}. Please use a valid pro
Error message
Unknown provider: ${config.provider}. Please use a valid provider. What it means
Thrown by AIbitat.#buildProviderForConfig() when config.provider is a string that matches no case in its switch (which lists ~40 providers). The function first short-circuits if config.provider is an object (custom provider instance); this throw only fires for an unrecognized provider string. It is the single validation gate for provider identity.
Source
Thrown at server/utils/agents/aibitat/index.js:1502
return new Providers.GiteeAIProvider({ model: config.model });
case "cohere":
return new Providers.CohereProvider({ model: config.model });
case "docker-model-runner":
return new Providers.DockerModelRunnerProvider({ model: config.model });
case "privatemode":
return new Providers.PrivatemodeProvider({ model: config.model });
case "sambanova":
return new Providers.SambaNovaProvider({ model: config.model });
case "lemonade":
return new Providers.LemonadeProvider({ model: config.model });
case "omlx":
return new Providers.OMLXProvider({ model: config.model });
case "minimax":
return new Providers.MinimaxProvider({ model: config.model });
case "cerebras":
return new Providers.CerebrasProvider({ model: config.model });
default:
throw new Error(
`Unknown provider: ${config.provider}. Please use a valid provider.`
);
}
}
/**
* Register a new function to be called by the AIbitat agents.
* You are also required to specify the which node can call the function.
* @param functionConfig The function configuration.
*/
function(functionConfig) {
this.functions.set(functionConfig.name, functionConfig);
return this;
}
/**
* Remove a registered function so the agent can no longer call it on its next
* turn. Used to disable a tool mid-session; restore it by re-running its pluginView on GitHub (pinned to 526360e320)
Solutions
- Match config.provider exactly to one of the case labels in #buildProviderForConfig (lowercase, no spaces).
- Check the supported-providers list for your AnythingLLM version.
- If the provider was renamed, update the stored config to the new identifier.
- Upgrade to a version that supports the provider, or pass a provider object instead of a string.
Example fix
// before - typo in provider identifier
getProviderForConfig({ provider: "anthrpic", model: "claude-3" });
// after - exact match
getProviderForConfig({ provider: "anthropic", model: "claude-3" }); Defensive patterns
Strategy: validation
Validate before calling
// validate provider identifier before instantiating
const KNOWN_PROVIDERS = ["openai","anthropic","azure","ollama","lmstudio","groq","gemini","togetherai","openrouter","mistral","deepseek","xai","zai","bedrock","cohere","localai","generic-openai","perplexity","fireworksai","litellm","apipie","mistral","novita","ppio","cometapi","foundry","giteeai","sambanova","lemonade","omlx","minimax","cerebras","nvidia-nim","moonshotai","textgenwebui","koboldcpp","docker-model-runner","privatemode"];
function validateProvider(provider) {
if (typeof provider === "string" && !KNOWN_PROVIDERS.includes(provider))
throw new Error(`Unknown provider: ${provider}`);
} Type guard
const isKnownProvider = (p) => typeof p === "object" || (typeof p === "string" && KNOWN_PROVIDERS.includes(p));
Try / catch
try {
aibitat.getProviderForConfig(config);
} catch (error) {
if (error.message.startsWith("Unknown provider")) {
// prompt the user to select a supported provider
} else throw error;
} Prevention
- Store provider identifiers exactly as defined in the switch (lowercase, hyphenated where applicable).
- Validate provider strings at the settings boundary before persisting them.
- After upgrades, migrate any renamed provider identifiers in stored config.
When it happens
Trigger: config.provider is a string not equal to any of the supported identifiers (openai, anthropic, ollama, lmstudio, groq, azure, gemini, etc.). Causes include a typo, a renamed/deprecated provider identifier, or a provider string from an incompatible version.
Common situations: Typo in the provider setting (e.g., "anthrpic"); a provider renamed between versions; a configuration/database value written by a different build; copy-pasting a provider name with different casing or spacing.
Related errors
- No token context limit was set.
- No NVIDIA NIM token context limit was set.
- OMLX must have a valid model set.
- OpenAI chat: ${this.model} is not valid for chat completion!
- OpenRouter chat: ${this.model} is not valid for chat complet
AI-assisted analysis of Mintplex-Labs/anything-llm@526360e320 (2026-08-13).
Data as JSON: /api/errors/7f59fa699b23eef1.
Report an issue: GitHub.