continuedev/continue · error · Error

AI SDK provider does not support fill-in-the-middle (FIM) co

Error message

AI SDK provider does not support fill-in-the-middle (FIM) completions.

What it means

The AiSdk adapter delegates to the Vercel AI SDK, which has no fill-in-the-middle (FIM) completion API. fimStream is therefore a hard stub that throws for every call. Use a provider adapter that natively supports FIM (e.g. Codestral/OpenAI-compatible FIM endpoints).

Source

Thrown at packages/openai-adapters/src/apis/AiSdk.ts:260

    throw new Error(
      "AI SDK provider does not support legacy completions API. Use chat completions instead.",
    );
  }

  async *completionStream(
    _body: CompletionCreateParamsStreaming,
    _signal: AbortSignal,
  ): AsyncGenerator<Completion> {
    throw new Error(
      "AI SDK provider does not support legacy completions API. Use chat completions instead.",
    );
  }

  async *fimStream(
    _body: FimCreateParamsStreaming,
    _signal: AbortSignal,
  ): AsyncGenerator<ChatCompletionChunk> {
    throw new Error(
      "AI SDK provider does not support fill-in-the-middle (FIM) completions.",
    );
  }

  async embed(body: EmbeddingCreateParams): Promise<CreateEmbeddingResponse> {
    this.initializeProvider();

    const { embed: aiEmbed, embedMany } = await import("ai");

    const modelId = typeof body.model === "string" ? body.model : body.model;
    const model = this.provider!(modelId);

    const inputs = Array.isArray(body.input) ? body.input : [body.input];
    const stringInputs = inputs.map((input) =>
      typeof input === "string" ? input : String(input),
    );

    if (stringInputs.length === 1) {

View on GitHub (pinned to 5522c6f44c)

Solutions

  1. Configure a FIM-capable adapter (Codestral, HuggingFace FIM, OpenAI-compatible FIM endpoint) for autocomplete
  2. Route only chat/embedding traffic through AiSdk and keep FIM on a separate provider config
  3. Guard call sites: check the adapter type before invoking fimStream

Example fix

// before
const chunks = api.fimStream({ prompt, suffix, model }, signal);

// after
const fimApi = new Codestral(...); // FIM-capable adapter
const chunks = fimApi.fimStream({ prompt, suffix, model }, signal);
Defensive patterns

Strategy: type-guard

Validate before calling

if (api instanceof AiSdk) throw new Error('Configure a FIM-capable adapter for autocomplete');

Type guard

function supportsFim(api: BaseApi): boolean {
  return typeof api.fimStream === 'function' && !(api instanceof AiSdk) && !(api instanceof Anthropic);
}

Try / catch

try { yield* api.fimStream(body, signal); }
catch (e) { if (/fill-in-the-middle/.test(String(e))) return; /* degrade to no autocomplete */ throw e; }

Prevention

When it happens

Trigger: Calling fimStream(body, signal) on an AiSdk adapter, e.g. code-completion features in an editor plugin configured with an AI SDK provider.

Common situations: Configuring a coding assistant's FIM/autocomplete backend with the AI SDK provider type instead of a FIM-capable adapter like Mistral Codestral or Continue's FIM adapters.

Related errors


AI-assisted analysis of continuedev/continue@5522c6f44c (2026-08-27). Data as JSON: /api/errors/5ef6dddca72e62f9. Report an issue: GitHub.