vercel/ai · error · NoSuchModelError

embeddingModel

Error message

embeddingModel

What it means

The MiniMax provider instance does not implement embedding models: calling minimax.embeddingModel(modelId) (or minimax.textEmbeddingModel) always throws NoSuchModelError with modelType 'embeddingModel'. The provider only supports chat/language and video models; embeddings are intentionally unavailable.

Source

Thrown at packages/minimax/src/minimax-provider.ts:146

  const createVideoModel = (modelId: MiniMaxVideoModelId) =>
    new MiniMaxVideoModel(modelId, {
      provider: 'minimax.video',
      baseURL: videoBaseURL,
      headers: getVideoHeaders,
      fetch: options.fetch,
    });

  const provider = (modelId: MiniMaxChatModelId) => createChatModel(modelId);

  provider.specificationVersion = 'v4' as const;
  provider.languageModel = createChatModel;
  provider.chat = createChatModel;
  provider.video = createVideoModel;
  provider.videoModel = createVideoModel;

  provider.embeddingModel = (modelId: string) => {
    throw new NoSuchModelError({ modelId, modelType: 'embeddingModel' });
  };
  provider.textEmbeddingModel = provider.embeddingModel;
  provider.imageModel = (modelId: string) => {
    throw new NoSuchModelError({ modelId, modelType: 'imageModel' });
  };

  return provider;
}

export const minimax = createMiniMax();

View on GitHub (pinned to 69428b1f8b)

Solutions

  1. Use a provider that implements text embeddings (e.g. openai.textEmbeddingModel('text-embedding-3-small'), amazon-bedrock, google) for embed/embedMany calls.
  2. Keep minimax only for language/chat (minimax(modelId) or minimax.chat) and video (minimax.videoModel) models.
  3. Guard embedding code paths with a capability check instead of unconditionally calling provider.embeddingModel.

Example fix

// before
const { embedding } = await embed({
  model: minimax.embeddingModel('embo-1'),
  value: text,
});
// after
const { embedding } = await embed({
  model: openai.textEmbeddingModel('text-embedding-3-small'),
  value: text,
});
Defensive patterns

Strategy: validation

Validate before calling

if (!('textEmbeddingModel' in minimax) || isStubModelFactory(minimax.embeddingModel)) {
  throw new Error('minimax does not support embeddings; choose another provider');
}
// or simply: use openai.textEmbeddingModel / cohere / amazon-bedrock for embed()

Type guard

function supportsEmbeddings(p: any): p is { textEmbeddingModel: (id: string) => EmbeddingModel } {
  try { p.textEmbeddingModel('probe'); return true; } catch { return false; }
}

Try / catch

try {
  await embed({ model: provider.textEmbeddingModel(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 minimax.embeddingModel(id), minimax.textEmbeddingModel(id), or passing the minimax provider to an API that resolves an embedding model internally, e.g. embed({ model: minimax.embeddingModel('...') }) or embedMany with the minimax provider.

Common situations: Developers switching a codebase from another provider (e.g. openai.textEmbeddingModel) to minimax assuming feature parity, or generically selecting a provider's embeddingModel factory in embedding pipelines.

Related errors


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