mem0ai/mem0 · error · Error
Unknown provider in model: ${model}
Error message
Unknown provider in model: ${model} What it means
When no providerOverride is given, extractProvider() scans the model id for a word-boundary match against the PROVIDERS list (ai21, amazon, anthropic, cohere, meta, mistral, stability, writer, deepseek, gpt-oss, perplexity, snowflake, titan, command, j2, llama, minimax). If none appears, the SDK cannot infer how to parse the response, so it throws with the model id that failed.
Source
Thrown at mem0-ts/src/oss/src/llms/aws_bedrock.ts:50
export function extractProvider(
model: string,
providerOverride?: string,
): string {
if (providerOverride) {
if (!PROVIDERS.includes(providerOverride)) {
throw new Error(
`Unknown providerOverride '${providerOverride}'. Valid providers: ${PROVIDERS.join(", ")}`,
);
}
return providerOverride;
}
for (const provider of PROVIDERS) {
const re = new RegExp(
`\\b${provider.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}\\b`,
);
if (re.test(model)) return provider;
}
throw new Error(`Unknown provider in model: ${model}`);
}
/**
* AWS Bedrock fields (awsRegion / awsAccessKeyId / awsSecretAccessKey /
* awsSessionToken / client) now live on the shared `LLMConfig`, so the
* provider is configurable through the standard typed `Memory` config path.
*/
type AWSBedrockConfig = LLMConfig;
/**
* AWS Bedrock LLM provider for the TypeScript OSS SDK.
*
* Mirrors `mem0/llms/aws_bedrock.py`. Uses the Bedrock **Converse API**
* (`ConverseCommand`), which provides a uniform message/tool interface across
* the Anthropic / Amazon (Nova) / Meta / Mistral / Cohere model families, so a
* single code path serves them all (the Python provider keeps per-family
* `invoke_model` branches for legacy reasons; Converse supersedes them).
*View on GitHub (pinned to 001c235229)
Solutions
- Use the full Bedrock model id including the provider prefix, e.g. 'anthropic.claude-3-sonnet-20240229-v1:0'
- If the id genuinely lacks a provider token, set providerOverride to the correct family (e.g. 'anthropic')
- For brand-new Bedrock models not in the list, providerOverride is the only path; also report an issue so the list is extended
Example fix
// before
new AWSBedrockLLM({ model: "claude-3-sonnet" }); // no provider token
// after
new AWSBedrockLLM({ model: "claude-3-sonnet", providerOverride: "anthropic" });
// or use the full id: "anthropic.claude-3-sonnet-20240229-v1:0" Defensive patterns
Strategy: validation
Validate before calling
const KNOWN = ["ai21","amazon","anthropic","cohere","meta","mistral","stability","writer","deepseek","gpt-oss","perplexity","snowflake","titan","command","j2","llama","minimax"];
const hasProvider = KNOWN.some((p) => new RegExp(`\\b${p}\\b`).test(modelId));
if (!hasProvider && !override) {
throw new Error(`Model id '${modelId}' contains no known provider - set providerOverride`);
} Type guard
function isUnknownProviderModelError(err: unknown): boolean {
return err instanceof Error && err.message.startsWith("Unknown provider in model:");
} Try / catch
try { extractProvider(modelId); }
catch (err) {
if (err instanceof Error && err.message.startsWith("Unknown provider in model:")) {
throw new Error("Use the full Bedrock model id (e.g. anthropic.claude-3-...) or pass providerOverride");
}
throw err;
} Prevention
- Always use complete Bedrock model ids with the provider prefix
- For custom/inference-profile ids, always set providerOverride
- Validate model ids against your account (aws bedrock list-foundation-models) at startup
When it happens
Trigger: Passing a bare model name like 'claude-3-sonnet' (no 'anthropic.' prefix), 'my-custom-model', or an inference-profile / marketplace ARN whose identifier contains no recognized provider token; region-prefixed ids like 'eu.anthropic...' actually match ('anthropic' token), but fully custom fine-tune names do not.
Common situations: Custom or fine-tuned model names; CrossRegionInference profile ids; copying display names from the Bedrock console instead of the model id; new provider models added to Bedrock before this list is updated.
Related errors
- Unknown providerOverride '${providerOverride}'. Valid provid
- Together API key is required
- Failed to parse googleServiceAccountJson: ${err.message}
- Vertex AI could not determine a Google Cloud project ID. Set
- Anthropic API key is required
AI-assisted analysis of mem0ai/mem0@001c235229 (2026-08-15).
Data as JSON: /api/errors/fe6e5cb8379b9483.
Report an issue: GitHub.