Description
Description
#18456 fixed assistant messages going out empty after unsigned reasoning is dropped — but there's a sibling case that still bricks conversations.
If the filtered-out message carries a cachePoint provider option, the new guard sees [{ cachePoint }], length 1, and sends it anyway. Bedrock rejects it, non-retryable:
There is nothing available to cache. Please remove the invalid cache point and try again.
Same story as #18452 from there... the poisoned turn stays in history and every following request fails.
This happens in the wild: opencode stamps cache points on the last two messages, so any assistant turn aborted mid-thinking hits this (anomalyco/opencode#11210 has both error strings).
Reproduction
Same as #18452's repro, just add the provider option to the assistant message:
{
role: 'assistant',
content: [{ type: 'reasoning', text: 'Let me consider the options' }], // aborted turn, no signature
providerOptions: { bedrock: { cachePoint: { type: 'default' } } },
},The outgoing request contains an assistant message with content: [{"cachePoint":{"type":"default"}}]. I sent that exact payload to the live Converse API and it 400s with the message above.
Expected behavior
A message whose only remaining content is a cache point should be omitted, same as the empty case #18456 already handles. Dropping it is safe — I also checked that Converse accepts consecutive user messages, which is what's left behind.
Happy to PR, it's a one-line change to the #18456 guard.
AI SDK Version
@ai-sdk/amazon-bedrockcurrent main (also verified on 5.0.43+)
Activity
ai-sdk-factory commentedon Aug 27, 2026
Identify issue type
Identified as Bug
Confidence: High
Rationale
The issue describes a concrete failure in existing Amazon Bedrock provider behavior: filtering unsigned reasoning can leave a cachePoint-only assistant message that is invalid for Bedrock and breaks the conversation.
Evidence
ai-sdk-factory commentedon Aug 27, 2026
Bug Reproduction - AI SDK 7
Bug was reproduced.
Branch:
mainPR: successful reproduction pull request
Details
@ai-sdk/amazon-bedrock5.0.66,examples/ai-functions/src/reproduction/amazon-bedrock-cache-point-only-assistant.tssent a cachePoint-only assistant message after filtering unsigned reasoning; two consecutive follow-up requests received Bedrock's non-retryable 400 instead of completing.packages/amazon-bedrock/src/convert-to-amazon-bedrock-chat-messages.test.tsnow contains a regression test expecting the cachePoint-only assistant message to be omitted; it fails because the converter retains that message.packages/amazon-bedrock/src/__fixtures__/amazon-bedrock-cache-point-only-assistant-error.jsonrecords the exact live Bedrock error response.Relevant Documentation
fix #19851
ai-sdk-factory commentedon Aug 27, 2026
Bugfix - AI SDK 7
Created bugfix and opened PR: #19858
Root Cause
The assistant-message guard checked only whether converted content was non-empty. Adding a cache point made the array non-empty after unsigned reasoning was filtered, so the invalid message remained; the failing regression test confirmed the exact malformed output.
Summary
The Bedrock converter now emits assistant messages only when at least one non-cache-point content block remains. Reproduction artifacts were removed and a patch changeset was added.
Testing
Added regression coverage verifying that unsigned reasoning with a cache point is omitted while surrounding user messages remain.
nabilfreeman commentedon Aug 27, 2026
@ai-sdk-factory I thought my PR was already good? #19852
fix: omit cachePoint-only Bedrock assistant messages after reasoning …
ai-sdk-factory commentedon Aug 27, 2026
Bug Reproduction - AI SDK 6
Bug was reproduced.
Branch:
release-v6.0PR: successful reproduction pull request
Details
examples/ai-functions/src/reproduction/amazon-bedrock-cache-point-only-assistant.tsobserved two consecutive HTTP 400 responses because the outgoing assistant message contained only{"cachePoint":{"type":"default"}}; both requests should complete after that empty assistant turn is omitted.packages/amazon-bedrock/src/convert-to-bedrock-chat-messages.tsfilters unsigned reasoning but retains the message-level cache point, and its non-empty-array guard consequently emits the invalid assistant message.packages/amazon-bedrock/src/convert-to-bedrock-chat-messages.test.tsexpects the cache-point-only assistant turn to be omitted while preserving both user inputs, but currently fails because all three turns are emitted.packages/amazon-bedrock/src/__fixtures__/amazon-bedrock-cache-point-only-assistant-error.jsonrecords the exact live Bedrock validation response.Relevant Documentation
ai-sdk-factory commentedon Aug 27, 2026
Bug Reproduction - AI SDK 5
Bug was reproduced.
Branch:
release-v5.0PR: successful reproduction pull request
Details
release-v5with@ai-sdk/amazon-bedrock3.0.125,examples/ai-functions/src/reproduction/amazon-bedrock-cache-point-only-assistant.tssent a cachePoint-only assistant message after filtering unsigned reasoning; two consecutive follow-up requests received Bedrock 400 responses stating "There is nothing available to cache."packages/amazon-bedrock/src/convert-to-bedrock-chat-messages.test.tsadds a regression assertion that the assistant turn is omitted and surrounding user content is retained; it fails because the converter emitscontent: [{ cachePoint: { type: 'default' } }].packages/amazon-bedrock/src/__fixtures__/amazon-bedrock-cache-point-only-assistant-error.jsonrecords the exact live Bedrock error response.examples/ai-functions/package.jsonandpnpm-lock.yamlprovide the workspace setup required to replay the live reproduction.Relevant Documentation
ai-sdk-factory commentedon Aug 27, 2026
Backport to v6.0
created: #19888 (fixed merge).
github-actions commentedon Aug 28, 2026
🚀 Published in:
ai@ai-sdk/alibaba@ai-sdk/amazon-bedrock@ai-sdk/angular@ai-sdk/anthropic@ai-sdk/anthropic-aws@ai-sdk/assemblyai@ai-sdk/azure@ai-sdk/baseten@ai-sdk/black-forest-labs@ai-sdk/bytedance@ai-sdk/cartesia@ai-sdk/cerebras@ai-sdk/code-mode@ai-sdk/cohere@ai-sdk/deepgram@ai-sdk/deepinfra@ai-sdk/deepseek@ai-sdk/elevenlabs@ai-sdk/fal@ai-sdk/fireworks@ai-sdk/fish-audio@ai-sdk/gateway@ai-sdk/gladia@ai-sdk/gmicloud@ai-sdk/google@ai-sdk/google-vertex@ai-sdk/groq@ai-sdk/harness@ai-sdk/harness-acp@ai-sdk/harness-claude-code@ai-sdk/harness-cline@ai-sdk/harness-codex@ai-sdk/harness-cursor@ai-sdk/harness-deepagents@ai-sdk/harness-fx@ai-sdk/harness-grok-build@ai-sdk/harness-opencode@ai-sdk/harness-pi@ai-sdk/huggingface@ai-sdk/hume@ai-sdk/klingai@ai-sdk/langchain@ai-sdk/llamaindex@ai-sdk/lmnt@ai-sdk/luma@ai-sdk/mcp@ai-sdk/minimax@ai-sdk/mistral@ai-sdk/moonshotai@ai-sdk/open-responses@ai-sdk/openai@ai-sdk/openai-compatible@ai-sdk/otel@ai-sdk/perplexity@ai-sdk/policy-opa@ai-sdk/prodia@ai-sdk/provider-utils@ai-sdk/quiverai@ai-sdk/react@ai-sdk/replicate@ai-sdk/revai@ai-sdk/rsc@ai-sdk/sandbox-just-bash@ai-sdk/sandbox-vercel@ai-sdk/svelte@ai-sdk/togetherai@ai-sdk/tui@ai-sdk/valibot@ai-sdk/voyage@ai-sdk/vue@ai-sdk/workflow@ai-sdk/workflow-harness@ai-sdk/xai@ai-sdk/zai[v6.0] fix: omit cachePoint-only Bedrock assistant messages after rea…
ai-sdk-factory commentedon Aug 28, 2026
Backport to v5.0
created: #19940 (fixed merge).
[v5.0] fix: omit cachePoint-only Bedrock assistant messages after rea…