{"record":{"id":"97d346c850757825","repo":"vercel/ai","slug":"ai-nosuchmodelerror-97d346","errorCode":"AI_NoSuchModelError","errorMessage":"No such embeddingModel: ${modelId}","messagePattern":"No such embeddingModel: (.+?)","errorType":"exception","errorClass":"NoSuchModelError","httpStatus":null,"severity":"error","filePath":"packages/luma/src/luma-provider.ts","lineNumber":80,"sourceCode":"          apiKey: options.apiKey,\n          environmentVariableName: 'LUMA_API_KEY',\n          description: 'Luma',\n        })}`,\n        ...options.headers,\n      },\n      `ai-sdk/luma/${VERSION}`,\n    );\n\n  const createImageModel = (modelId: LumaImageModelId) =>\n    new LumaImageModel(modelId, {\n      provider: 'luma.image',\n      baseURL: baseURL ?? defaultBaseURL,\n      headers: getHeaders,\n      fetch: options.fetch,\n    });\n\n  const embeddingModel = (modelId: string) => {\n    throw new NoSuchModelError({\n      modelId,\n      modelType: 'embeddingModel',\n    });\n  };\n\n  return {\n    specificationVersion: 'v4' as const,\n    image: createImageModel,\n    imageModel: createImageModel,\n    languageModel: (modelId: string) => {\n      throw new NoSuchModelError({\n        modelId,\n        modelType: 'languageModel',\n      });\n    },\n    embeddingModel,\n    textEmbeddingModel: embeddingModel,\n  };","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/luma/src/luma-provider.ts#L62-L98","documentation":"The Luma provider does not implement embedding models; calling luma.embeddingModel(modelId) or luma.textEmbeddingModel(modelId) intentionally throws NoSuchModelError (code AI_NoSuchModelError). Luma is an image/video generation provider, so any embedding request through it is a programming error surfaced early with the requested modelId in the message.","triggerScenarios":"Calling luma.embedding('any-id') or luma.textEmbeddingModel('any-id') and passing the result to embed()/embedMany(), e.g. after copy-pasting provider setup code from an OpenAI example.","commonSituations":"Swapping model providers in a RAG pipeline and assuming all providers expose embeddings; auto-selecting a provider by name without checking capability; typos leading to the wrong provider object being used.","solutions":["Use a provider that implements embeddings, e.g. openai.textEmbeddingModel('text-embedding-3-small') or providers like amazon-bedrock/cohere/mistral.","Check the provider's exported surface (imageModel vs textEmbeddingModel) before wiring embed()/embedMany().","Centralize provider selection so embedding code only receives embedding-capable providers.","If a capability check is needed, guard with instanceof/feature detection on the returned model's specificationVersion/type."],"exampleFix":"// before\nconst model = luma.textEmbeddingModel('text-embedding-1');\nconst { embedding } = await embed({ model, value: 'hello' });\n// after\nimport { openai } from '@ai-sdk/openai';\nconst model = openai.textEmbeddingModel('text-embedding-3-small');\nconst { embedding } = await embed({ model, value: 'hello' });","handlingStrategy":"try-catch","validationCode":"function supportsEmbeddings(provider) {\n  try {\n    return typeof provider.textEmbeddingModel === 'function' &&\n      // probe a call; Luma's version always throws\n      (provider.textEmbeddingModel('probe'), true);\n  } catch {\n    return false;\n  }\n}","typeGuard":"function isNoSuchModelError(e: unknown): e is { code: 'AI_NoSuchModelError'; modelId: string; modelType: string } {\n  return typeof e === 'object' && e !== null && (e as any).code === 'AI_NoSuchModelError';\n}","tryCatchPattern":"import { NoSuchModelError } from 'ai';\ntry {\n  const model = luma.textEmbeddingModel('any');\n} catch (e) {\n  if (NoSuchModelError.isInstance(e)) {\n    throw new Error(`Provider does not support ${e.modelType}; use e.g. openai.textEmbeddingModel()`);\n  }\n  throw e;\n}","preventionTips":["Never route embed/embedMany through an image-only provider like Luma.","Map each pipeline stage (text, image, embedding) to capability-matched providers.","Check provider docs/exports before generic provider swapping.","Add a startup capability test per provider in CI."],"tags":["no-such-model","embeddings","provider-capability","luma"],"backgroundTag":"no-such-model-error","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}