continuedev/continue · error · Error

Bedrock does not support completions API

Error message

Bedrock does not support completions API

What it means

Bedrock's runtime API only exposes conversational/invoke-model endpoints, not the legacy OpenAI-style /v1/completions text-completion API. The adapter therefore implements the CompletionCreateParamsNonStreaming surface by unconditionally throwing when completionNonStream is called — it is a hard capability gap, not a runtime failure.

Source

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

    } catch (error) {
      if (error instanceof Error) {
        if ("code" in error) {
          throw new Error(
            `AWS Bedrock stream error (${(error as any).code}): ${error.message}`,
          );
        }
        throw new Error(`Error processing Bedrock stream: ${error.message}`);
      }
      throw new Error(
        "Error processing Bedrock stream: Unknown error occurred",
      );
    }
  }

  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,

View on GitHub (pinned to 5522c6f44c)

Solutions

  1. Switch the call to chatCompletionNonStream with a messages array ([{role: 'user', content: prompt}]).
  2. If you must keep the completions interface, route Bedrock traffic to a different backend or wrap it in a translation layer that converts prompt→messages.
  3. Add a capability check in your router so Bedrock requests never reach completionNonStream.

Example fix

// before
const result = await api.completionNonStream({ model: 'bedrock/anthropic.claude-3-sonnet', prompt: 'Hello' });

// after
const result = await api.chatCompletionNonStream({ model: 'bedrock/anthropic.claude-3-sonnet', messages: [{ role: 'user', content: 'Hello' }] });
Defensive patterns

Strategy: validation

Validate before calling

const supportsCompletions = (api: any) => typeof (api as any).completionNonStream === 'function' && api.constructor.name !== 'Bedrock';
if (!supportsCompletions(api)) throw new Error('Use chatCompletionNonStream for this provider');

Prevention

When it happens

Trigger: Calling completionNonStream({model: 'bedrock/...', prompt: '...'}) on the Bedrock adapter; generic router code that dispatches every provider through the completions API; porting code from an OpenAI adapter to Bedrock without changing the endpoint.

Common situations: Multi-provider abstraction layers that assume all adapters support legacy completions; older codebases migrating from Codex-style prompt completion to chat; tools defaulting to the completions endpoint when no messages array is present.

Related errors


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