{"record":{"id":"64fae6f1e0a52df6","repo":"vercel/ai","slug":"ai-nosuchmodelerror-64fae6","errorCode":"AI_NoSuchModelError","errorMessage":"No such embeddingModel: ${modelId}","messagePattern":"No such embeddingModel: (.+?)","errorType":"exception","errorClass":"NoSuchModelError","httpStatus":null,"severity":"error","filePath":"packages/bytedance/src/bytedance-provider.ts","lineNumber":103,"sourceCode":"    new ByteDanceVideoModel(modelId, {\n      provider: 'bytedance.video',\n      baseURL: baseURL ?? defaultBaseURL,\n      headers: getHeaders,\n      fetch: options.fetch,\n    });\n\n  const createImageModel = (modelId: ByteDanceImageModelId) =>\n    new ByteDanceImageModel(modelId, {\n      provider: 'bytedance.image',\n      baseURL: baseURL ?? defaultBaseURL,\n      headers: getHeaders,\n      fetch: options.fetch,\n    });\n\n  return {\n    specificationVersion: 'v4' as const,\n    embeddingModel: (modelId: string) => {\n      throw new NoSuchModelError({ modelId, modelType: 'embeddingModel' });\n    },\n    languageModel: (modelId: string) => {\n      throw new NoSuchModelError({ modelId, modelType: 'languageModel' });\n    },\n    image: createImageModel,\n    imageModel: createImageModel,\n    video: createVideoModel,\n    videoModel: createVideoModel,\n  };\n}\n\n/**\n * Default ByteDance provider instance.\n */\nexport const byteDance = createByteDance();\n","sourceCodeStart":85,"sourceCodeEnd":119,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/bytedance/src/bytedance-provider.ts#L85-L119","documentation":"The ByteDance provider (createByteDance / bytedance) only implements image and video models; its embeddingModel factory unconditionally throws NoSuchModelError with modelType 'embeddingModel' for any modelId. Calling embed/embedMany with the bytedance provider therefore always fails. Use a provider that implements embeddings instead.","triggerScenarios":"Calling bytedance.embeddingModel('some-id') directly, or embed()/embedMany() with provider 'bytedance' and a model id, which reaches the throwing embeddingModel factory in createByteDance.","commonSituations":"Assuming ByteDance/Ark support in the AI SDK covers embeddings because it covers images and video; switching a shared model factory from another provider (e.g. openai) to bytedance; typos where bytedance was chosen instead of the intended embedding provider.","solutions":["Use a provider that implements embeddings (e.g. openai.embeddingModel, or a Bedrock/other provider supporting embeddings) with embed/embedMany.","For ByteDance embeddings via Ark's HTTP API, call the API directly with a custom fetch or a custom LanguageModel/embedding provider implementation.","If you only need image or video generation, switch the call to bytedance.image()/bytedance.video()."],"exampleFix":"// before\nconst model = bytedance.embeddingModel('doubao-embedding');\nawait embed({ model, value: 'hello' });\n// after\nconst model = openai.embeddingModel('text-embedding-3-small');\nawait embed({ model, value: 'hello' });","handlingStrategy":"fallback","validationCode":"if (!('embeddingModel' in bytedance) || isBytedanceProvider(provider)) {\n  throw new Error('bytedance does not support embeddingModel; use openai or another embedding provider.');\n}","typeGuard":"function supportsEmbeddings(p: unknown): p is { embeddingModel: (id: string) => EmbeddingModel } {\n  return typeof (p as any)?.embeddingModel === 'function';\n}","tryCatchPattern":"try {\n  const { embedding } = await embed({ model: provider.embeddingModel(id), value });\n} catch (e) {\n  if (NoSuchModelError.isInstance(e) && e.modelType === 'embeddingModel') {\n    // fall back to an embedding-capable provider\n  }\n  throw e;\n}","preventionTips":["Check the provider's supported model types (image/video only for bytedance) before wiring embeddings.","Keep a single embedding provider (e.g. openai) in your codebase so model selection is centralized.","Smoke-test provider capability at startup in dev environments to catch wrong-provider mistakes early."],"tags":["embeddings","unsupported-feature","no-such-model","provider-capability"],"backgroundTag":"no-such-model-error","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}