{"record":{"id":"065cc44d58d1c4dc","repo":"continuedev/continue","slug":"bedrock-does-not-support-fim-directly","errorCode":null,"errorMessage":"Bedrock does not support FIM directly","messagePattern":"Bedrock does not support FIM directly","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/openai-adapters/src/apis/Bedrock.ts","lineNumber":589,"sourceCode":"    }\n  }\n\n  completionNonStream(\n    body: CompletionCreateParamsNonStreaming,\n  ): Promise<Completion> {\n    throw new Error(\"Bedrock does not support completions API\");\n  }\n\n  completionStream(\n    body: CompletionCreateParamsStreaming,\n  ): AsyncGenerator<Completion> {\n    throw new Error(\"Bedrock does not support completions API\");\n  }\n\n  fimStream(\n    body: FimCreateParamsStreaming,\n  ): AsyncGenerator<ChatCompletionChunk> {\n    throw new Error(\"Bedrock does not support FIM directly\");\n  }\n\n  private async getInvokeModelResponseBody(model: string, jsonBody: object) {\n    const payload = {\n      body: JSON.stringify(jsonBody),\n      modelId: model,\n      accept: \"*/*\",\n      contentType: \"application/json\",\n    };\n    const command = new InvokeModelCommand(payload);\n    const client = await this.getClient();\n    const response = await client.send(command);\n    if (!response.body) {\n      throw new Error(\"No response body\");\n    }\n    const decoder = new TextDecoder();\n    const decoded = decoder.decode(response.body);\n    return JSON.parse(decoded);","sourceCodeStart":571,"sourceCodeEnd":607,"githubUrl":"https://github.com/continuedev/continue/blob/5522c6f44ca0ac3528b37244818fbfa39b5af470/packages/openai-adapters/src/apis/Bedrock.ts#L571-L607","documentation":"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.","triggerScenarios":"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.","commonSituations":"Pointing a coding-assistant tool at Bedrock while leaving FIM enabled; config that works against Codestral/Starcoder FIM endpoints then reused for Bedrock.","solutions":["Disable native FIM in the client and switch it to chat/prompt mode (prefix/suffix merged into a user message).","Use a provider that supports FIM natively (e.g. Codestral) for autocomplete, and Bedrock for chat.","Pre-check adapter capabilities before dispatching fimStream."],"exampleFix":"// before\nfor await (const c of api.fimStream({ model: 'bedrock/x', prompt, suffix })) {}\n\n// after\nconst msg = `${prefix}<CURSOR>${suffix}`;\nfor await (const c of api.chatCompletionStream({ model: 'bedrock/x', messages: [{ role: 'user', content: msg }], stream: true })) {}","handlingStrategy":"validation","validationCode":"const providerSupportsFim = (provider: string) => !['bedrock'].includes(provider);\nif (!providerSupportsFim(provider)) {\n  // fall back to chat-based autocomplete\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Disable native FIM mode for Bedrock in autocomplete tool config.","Emulate FIM by embedding prefix/suffix in a user message.","Keep FIM-capable and chat providers on separate code paths."],"tags":["bedrock","fim","unsupported-api","autocomplete"],"backgroundTag":"unsupported-api-endpoint","analyzedSha":"5522c6f44ca0ac3528b37244818fbfa39b5af470","analyzedAt":"2026-08-27T11:28:54.683Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}