{"record":{"id":"fe6e5cb8379b9483","repo":"mem0ai/mem0","slug":"unknown-provider-in-model-model","errorCode":null,"errorMessage":"Unknown provider in model: ${model}","messagePattern":"Unknown provider in model: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"mem0-ts/src/oss/src/llms/aws_bedrock.ts","lineNumber":50,"sourceCode":"export function extractProvider(\n  model: string,\n  providerOverride?: string,\n): string {\n  if (providerOverride) {\n    if (!PROVIDERS.includes(providerOverride)) {\n      throw new Error(\n        `Unknown providerOverride '${providerOverride}'. Valid providers: ${PROVIDERS.join(\", \")}`,\n      );\n    }\n    return providerOverride;\n  }\n  for (const provider of PROVIDERS) {\n    const re = new RegExp(\n      `\\\\b${provider.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\")}\\\\b`,\n    );\n    if (re.test(model)) return provider;\n  }\n  throw new Error(`Unknown provider in model: ${model}`);\n}\n\n/**\n * AWS Bedrock fields (awsRegion / awsAccessKeyId / awsSecretAccessKey /\n * awsSessionToken / client) now live on the shared `LLMConfig`, so the\n * provider is configurable through the standard typed `Memory` config path.\n */\ntype AWSBedrockConfig = LLMConfig;\n\n/**\n * AWS Bedrock LLM provider for the TypeScript OSS SDK.\n *\n * Mirrors `mem0/llms/aws_bedrock.py`. Uses the Bedrock **Converse API**\n * (`ConverseCommand`), which provides a uniform message/tool interface across\n * the Anthropic / Amazon (Nova) / Meta / Mistral / Cohere model families, so a\n * single code path serves them all (the Python provider keeps per-family\n * `invoke_model` branches for legacy reasons; Converse supersedes them).\n *","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/mem0ai/mem0/blob/001c235229be8795e3834520467bd0d661ed8f34/mem0-ts/src/oss/src/llms/aws_bedrock.ts#L32-L68","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nnew AWSBedrockLLM({ model: \"claude-3-sonnet\" }); // no provider token\n\n// after\nnew AWSBedrockLLM({ model: \"claude-3-sonnet\", providerOverride: \"anthropic\" });\n// or use the full id: \"anthropic.claude-3-sonnet-20240229-v1:0\"","handlingStrategy":"validation","validationCode":"const KNOWN = [\"ai21\",\"amazon\",\"anthropic\",\"cohere\",\"meta\",\"mistral\",\"stability\",\"writer\",\"deepseek\",\"gpt-oss\",\"perplexity\",\"snowflake\",\"titan\",\"command\",\"j2\",\"llama\",\"minimax\"];\nconst hasProvider = KNOWN.some((p) => new RegExp(`\\\\b${p}\\\\b`).test(modelId));\nif (!hasProvider && !override) {\n  throw new Error(`Model id '${modelId}' contains no known provider - set providerOverride`);\n}","typeGuard":"function isUnknownProviderModelError(err: unknown): boolean {\n  return err instanceof Error && err.message.startsWith(\"Unknown provider in model:\");\n}","tryCatchPattern":"try { extractProvider(modelId); }\ncatch (err) {\n  if (err instanceof Error && err.message.startsWith(\"Unknown provider in model:\")) {\n    throw new Error(\"Use the full Bedrock model id (e.g. anthropic.claude-3-...) or pass providerOverride\");\n  }\n  throw err;\n}","preventionTips":["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"],"tags":["aws-bedrock","configuration","model-id","typescript"],"backgroundTag":null,"analyzedSha":"001c235229be8795e3834520467bd0d661ed8f34","analyzedAt":"2026-08-15T01:55:42.685Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}