vercel/ai · error · NoSuchModelError

languageModel

Error message

languageModel

What it means

fal.ai does not support language models in the AI SDK, so the provider's `languageModel` factory always throws `NoSuchModelError` with modelType 'languageModel'. The fal provider only implements image, speech, and embedding models. Calling `fal.languageModel(...)` (or `fal(...)` for a language model) is always a programming error, never a runtime condition.

Source

Thrown at packages/fal/src/fal-provider.ts:189

      provider: 'fal.video',
      url: ({ path }) => path,
      headers: getHeaders,
      fetch: options.fetch,
    });

  const embeddingModel = (modelId: string) => {
    throw new NoSuchModelError({
      modelId,
      modelType: 'embeddingModel',
    });
  };

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

/**
 * Default fal.ai provider instance.
 */
export const fal = createFal();

View on GitHub (pinned to 69428b1f8b)

Solutions

  1. Use a text-capable provider (e.g. @ai-sdk/openai, @ai-sdk/anthropic) for generateText/streamText calls
  2. Use fal only for its supported capabilities: createFal image models (fal.image(...)), speech models, or embeddingModel
  3. If you need both text and fal media generation, keep two providers and pass the right one to each function

Example fix

// before
const model = fal('fal-ai/flux');
await generateText({ model, prompt: 'hi' });
// after
const imageModel = fal.image('fal-ai/flux/dev');
const { image } = await generateImage({ model: imageModel, prompt: 'a cat' });
Defensive patterns

Strategy: try-catch

Validate before calling

import { NoSuchModelError } from '@ai-sdk/provider';
const supportsLanguageModels = typeof fal.languageModel === 'function' && !isUnsupportedStub(fal);
// simply: never call fal.languageModel — check provider docs/capability before use

Type guard

function isNoSuchModelError(e: unknown): e is NoSuchModelError {
  return NoSuchModelError.isInstance(e);
}

Try / catch

try {
  await generateText({ model: fal('id'), prompt });
} catch (e) {
  if (NoSuchModelError.isInstance(e) && e.modelType === 'languageModel') {
    // fall back to an LLM-capable provider
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling `fal('some-model-id')` or `fal.languageModel('some-model-id')` and passing the result to generateText/streamText. Any code path that resolves a model via the provider's languageModel entry point.

Common situations: Developers assuming fal supports text generation because most AI SDK providers do; copy-pasting code written for openai/anthropic providers and swapping in `fal`; confusion between fal's image/speech capabilities and LLM support.

Related errors


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