continuedev/continue · error · Error

Bedrock does not support FIM directly

Error message

Bedrock does not support FIM directly

What it means

Bedrock does not expose a fill-in-the-middle (FIM) endpoint, so the adapter's fimStream throws unconditionally. FIM-style coding autocomplete must be emulated by stuffing the prefix/suffix into a chat prompt; the adapter deliberately does not do this silently.

Source

Thrown at packages/openai-adapters/src/apis/Bedrock.ts:589

    }
  }

  completionNonStream(
    body: CompletionCreateParamsNonStreaming,
  ): Promise<Completion> {
    throw new Error("Bedrock does not support completions API");
  }

  completionStream(
    body: CompletionCreateParamsStreaming,
  ): AsyncGenerator<Completion> {
    throw new Error("Bedrock does not support completions API");
  }

  fimStream(
    body: FimCreateParamsStreaming,
  ): AsyncGenerator<ChatCompletionChunk> {
    throw new Error("Bedrock does not support FIM directly");
  }

  private async getInvokeModelResponseBody(model: string, jsonBody: object) {
    const payload = {
      body: JSON.stringify(jsonBody),
      modelId: model,
      accept: "*/*",
      contentType: "application/json",
    };
    const command = new InvokeModelCommand(payload);
    const client = await this.getClient();
    const response = await client.send(command);
    if (!response.body) {
      throw new Error("No response body");
    }
    const decoder = new TextDecoder();
    const decoded = decoder.decode(response.body);
    return JSON.parse(decoded);

View on GitHub (pinned to 5522c6f44c)

Solutions

  1. Disable native FIM in the client and switch it to chat/prompt mode (prefix/suffix merged into a user message).
  2. Use a provider that supports FIM natively (e.g. Codestral) for autocomplete, and Bedrock for chat.
  3. Pre-check adapter capabilities before dispatching fimStream.

Example fix

// before
for await (const c of api.fimStream({ model: 'bedrock/x', prompt, suffix })) {}

// after
const msg = `${prefix}<CURSOR>${suffix}`;
for await (const c of api.chatCompletionStream({ model: 'bedrock/x', messages: [{ role: 'user', content: msg }], stream: true })) {}
Defensive patterns

Strategy: validation

Validate before calling

const providerSupportsFim = (provider: string) => !['bedrock'].includes(provider);
if (!providerSupportsFim(provider)) {
  // fall back to chat-based autocomplete
}

Prevention

When it happens

Trigger: Calling fimStream(body) with FimCreateParamsStreaming on a Bedrock adapter; autocomplete plugins (e.g. Continue, code-completion engines) configured to use Bedrock with native FIM mode.

Common situations: Pointing a coding-assistant tool at Bedrock while leaving FIM enabled; config that works against Codestral/Starcoder FIM endpoints then reused for Bedrock.

Related errors


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