{"record":{"id":"acdbf177ca5d0557","repo":"continuedev/continue","slug":"no-response-body","errorCode":null,"errorMessage":"No response body","messagePattern":"No response body","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/openai-adapters/src/apis/Bedrock.ts","lineNumber":603,"sourceCode":"\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);\n  }\n\n  private getEmbedTexts(body: EmbeddingCreateParams): string[] {\n    const texts: string[] = [];\n    if (typeof body.input === \"string\") {\n      texts.push(body.input);\n    } else if (body.input.length > 0) {\n      const firstVal = body.input[0];\n      if (Array.isArray(firstVal)) {\n        throw new Error(\"Unsupported embeddings type received: number[][]\");\n      }\n      if (typeof firstVal === \"string\") {\n        texts.push(...(body.input as string[]));\n      } else {","sourceCodeStart":585,"sourceCodeEnd":621,"githubUrl":"https://github.com/continuedev/continue/blob/5522c6f44ca0ac3528b37244818fbfa39b5af470/packages/openai-adapters/src/apis/Bedrock.ts#L585-L621","documentation":"getInvokeModelResponseBody sends an InvokeModelCommand and expects a binary body back; if the AWS SDK response has an empty/absent body (falsy response.body), the adapter throws 'No response body' before attempting to decode. This typically indicates the service returned an empty payload or the SDK/stream handling already consumed it.","triggerScenarios":"Calling embed, output, or responseBody paths that route through getInvokeModelResponseBody and the InvokeModel response arrives with an empty body; intermittent Bedrock service-side empty responses; SDK middleware transforming the response incorrectly.","commonSituations":"Transient Bedrock hiccups returning 200 with empty payload; mismatched AWS SDK v3 versions where response body handling changed; invoking an incompatible model that returns no JSON payload.","solutions":["Retry the request — empty bodies are usually transient.","Pin/upgrade @aws-sdk/client-bedrock-runtime to a stable version compatible with the adapter.","Verify with the AWS CLI that the same modelId + payload returns a body (aws bedrock-runtime invoke-model).","Check adapter issue tracker for known SDK version incompatibilities."],"exampleFix":"// before\nconst out = await api.getInvokeModelResponseBody(model, body);\n\n// after\nlet out;\nfor (let i = 0; i < 3; i++) {\n  try { out = await api.getInvokeModelResponseBody(model, body); break; }\n  catch (e) { if (e.message !== 'No response body' || i === 2) throw e; await new Promise(r => setTimeout(r, 2 ** i * 500)); }\n}","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"let lastErr;\nfor (let i = 0; i < 3; i++) {\n  try { return await api.embed(body); }\n  catch (e) {\n    lastErr = e;\n    if (e instanceof Error && e.message === 'No response body' && i < 2) { await new Promise(r => setTimeout(r, 2 ** i * 500)); continue; }\n    throw e;\n  }\n}\nthrow lastErr;","preventionTips":["Retry transient empty-body responses with backoff.","Pin a known-good @aws-sdk/client-bedrock-runtime version.","Probe models with a small request before batch jobs to detect the issue early."],"tags":["bedrock","empty-response","invoke-model","aws-sdk"],"backgroundTag":"empty-response-body","analyzedSha":"5522c6f44ca0ac3528b37244818fbfa39b5af470","analyzedAt":"2026-08-27T11:28:54.683Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}