vercel/ai · error · NoSuchModelError

imageModel

Error message

imageModel

What it means

AssemblyAI's `imageModel` factory is a stub that throws NoSuchModelError with modelType 'imageModel' for any modelId. The provider supports only transcription models, so image requests always fail.

Source

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

  provider.specificationVersion = 'v4' as const;
  provider.transcription = createTranscriptionModel;
  provider.transcriptionModel = createTranscriptionModel;

  provider.languageModel = () => {
    throw new NoSuchModelError({
      modelId: 'unknown',
      modelType: 'languageModel',
      message: 'AssemblyAI does not provide language models',
    });
  };

  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 as AssemblyAIProvider;
}

/**
 * Default AssemblyAI provider instance.
 */
export const assemblyai = createAssemblyAI();

View on GitHub (pinned to 69428b1f8b)

Solutions

  1. Use an image-capable provider such as OpenAI (`createOpenAI().image('dall-e-3')`), Google, or Amazon Bedrock.
  2. Restrict AssemblyAI usage to transcription and remove it from image model registries.

Example fix

// before
const image = await generateImage({ model: assemblyai.imageModel('x'), prompt });
// after
const image = await generateImage({ model: openai.image('dall-e-3'), prompt });
Defensive patterns

Strategy: fallback

Validate before calling

if (providerId === 'assemblyai') {
  throw new Error('AssemblyAI provides no image models; configure an image-capable provider');
}

Type guard

function supportsImages(p: any): boolean {
  try {
    p.imageModel?.('probe');
    return true;
  } catch (e) {
    return !(NoSuchModelError.isInstance(e) && e.modelType === 'imageModel');
  }
}

Try / catch

try {
  return await generateImage({ model: assemblyai.imageModel(id), prompt });
} catch (error) {
  if (NoSuchModelError.isInstance(error) && error.modelType === 'imageModel') {
    return generateImage({ model: openai.image('dall-e-3'), prompt });
  }
  throw error;
}

Prevention

When it happens

Trigger: Calling `assemblyai.imageModel('any-id')` or passing it to `generateImage({ model: ... })`.

Common situations: Misconfigured image-generation pipelines selecting AssemblyAI by mistake; copy-pasted provider setup code listing imageModel for every provider.

Related errors


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