vercel/ai · error · NoSuchModelError

AI_NoSuchModelError

AI_NoSuchModelError

Error message

No such embeddingModel: ${modelId}

What it means

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.

Source

Thrown at packages/bytedance/src/bytedance-provider.ts:103

    new ByteDanceVideoModel(modelId, {
      provider: 'bytedance.video',
      baseURL: baseURL ?? defaultBaseURL,
      headers: getHeaders,
      fetch: options.fetch,
    });

  const createImageModel = (modelId: ByteDanceImageModelId) =>
    new ByteDanceImageModel(modelId, {
      provider: 'bytedance.image',
      baseURL: baseURL ?? defaultBaseURL,
      headers: getHeaders,
      fetch: options.fetch,
    });

  return {
    specificationVersion: 'v4' as const,
    embeddingModel: (modelId: string) => {
      throw new NoSuchModelError({ modelId, modelType: 'embeddingModel' });
    },
    languageModel: (modelId: string) => {
      throw new NoSuchModelError({ modelId, modelType: 'languageModel' });
    },
    image: createImageModel,
    imageModel: createImageModel,
    video: createVideoModel,
    videoModel: createVideoModel,
  };
}

/**
 * Default ByteDance provider instance.
 */
export const byteDance = createByteDance();

View on GitHub (pinned to 69428b1f8b)

Solutions

  1. Use a provider that implements embeddings (e.g. openai.embeddingModel, or a Bedrock/other provider supporting embeddings) with embed/embedMany.
  2. For ByteDance embeddings via Ark's HTTP API, call the API directly with a custom fetch or a custom LanguageModel/embedding provider implementation.
  3. If you only need image or video generation, switch the call to bytedance.image()/bytedance.video().

Example fix

// before
const model = bytedance.embeddingModel('doubao-embedding');
await embed({ model, value: 'hello' });
// after
const model = openai.embeddingModel('text-embedding-3-small');
await embed({ model, value: 'hello' });
Defensive patterns

Strategy: fallback

Validate before calling

if (!('embeddingModel' in bytedance) || isBytedanceProvider(provider)) {
  throw new Error('bytedance does not support embeddingModel; use openai or another embedding provider.');
}

Type guard

function supportsEmbeddings(p: unknown): p is { embeddingModel: (id: string) => EmbeddingModel } {
  return typeof (p as any)?.embeddingModel === 'function';
}

Try / catch

try {
  const { embedding } = await embed({ model: provider.embeddingModel(id), value });
} catch (e) {
  if (NoSuchModelError.isInstance(e) && e.modelType === 'embeddingModel') {
    // fall back to an embedding-capable provider
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling bytedance.embeddingModel('some-id') directly, or embed()/embedMany() with provider 'bytedance' and a model id, which reaches the throwing embeddingModel factory in createByteDance.

Common situations: 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.

Related errors


AI-assisted analysis of vercel/ai@69428b1f8b (2026-08-30). Data as JSON: /api/errors/64fae6f1e0a52df6. Report an issue: GitHub.