openclaw/openclaw · error · Error
Bedrock redacted reasoning block is missing its opaque signa
Error message
Bedrock redacted reasoning block is missing its opaque signature
What it means
Thrown during message conversion (convertMessages) when an assistant message contains a redacted 'thinking' block (c.redacted === true), the model supports thinking signatures (supportsThinkingSignature(model)), but c.thinkingSignature is missing. Bedrock requires the opaque signature to replay redacted reasoning content; without it, the block cannot be reconstructed and the error protects against sending invalid content.
Source
Thrown at extensions/amazon-bedrock/stream.runtime.ts:976
if (c.text.trim().length === 0) {
continue;
}
contentBlocks.push({ text: sanitizeSurrogates(c.text) });
break;
case "toolCall":
contentBlocks.push({
toolUse: { toolUseId: c.id, name: c.name, input: c.arguments as DocumentType },
});
break;
case "thinking": {
if (c.redacted) {
// transformMessages already strips opaque reasoning after a model
// switch; this also rejects routes that cannot consume the format.
if (!supportsThinkingSignature(model)) {
continue;
}
if (!c.thinkingSignature) {
throw new Error(
"Bedrock redacted reasoning block is missing its opaque signature",
);
}
contentBlocks.push({
reasoningContent: {
redactedContent: decodeBedrockBase64(
c.thinkingSignature,
"Bedrock redacted reasoning block has a malformed opaque signature",
),
},
});
break;
}
const thinkingSignature = c.thinkingSignature;
const normalizedThinkingSignature = thinkingSignature?.trim();
const supportsSignature = supportsThinkingSignature(model);
const hasNativeThinkingSignature =
supportsSignature &&View on GitHub (pinned to 01804a7531)
Solutions
- Drop the redacted thinking block before sending (it cannot be replayed without its signature).
- Persist thinkingSignature alongside redacted reasoning content so replays are valid.
- If the history is from an external source, filter out thinking blocks missing signatures before conversion.
- Use a non-redacted thinking representation if signature persistence is unreliable.
Example fix
// before: history missing thinkingSignature triggers the throw
messages.push({ role: "assistant", content: [{ type: "thinking", redacted: true }] });
// after: drop blocks missing signatures before sending
const safeContent = msg.content.filter(
(c) => !(c.type === "thinking" && c.redacted && !c.thinkingSignature)
); Defensive patterns
Strategy: validation
Validate before calling
// Strip redacted thinking blocks that lack a signature before sending
function sanitizeThinkingBlocks(messages: any[]): any[] {
return messages.map((m) => ({
...m,
content: (m.content || []).filter(
(c: any) => !(c.type === "thinking" && c.redacted && !c.thinkingSignature)
),
}));
} Type guard
function hasValidRedactedSignature(block: { type?: string; redacted?: boolean; thinkingSignature?: unknown }): boolean {
if (block.type !== "thinking" || !block.redacted) return true;
return typeof block.thinkingSignature === "string" && block.thinkingSignature.length > 0;
} Prevention
- Persist thinkingSignature alongside redacted reasoning content in conversation history.
- Filter out thinking blocks missing signatures before replaying history.
- Avoid manually constructing redacted thinking blocks without the signature field.
When it happens
Trigger: Replaying a conversation history that includes a redacted reasoning block where the thinkingSignature field was not persisted or was stripped. The convertMessages path at stream.runtime.ts:968 hits the redacted branch, confirms the model supports signatures, and finds c.thinkingSignature falsy.
Common situations: Conversation history was persisted without the thinkingSignature (older format, partial save, or external tool that dropped it); a message was replayed after a format migration; or a redacted block was constructed manually without the signature. The guard prevents sending malformed reasoning content to Bedrock.
Related errors
- No API key found for provider bedrock: @aws-sdk/client-bedro
- Amazon Bedrock embedding response returned malformed JSON
- Invalid dimensions ${options.outputDimensionality} for ${mod
- No API key found for provider "bedrock". AWS credentials are
- Amazon Bedrock stream received unsupported API: ${model.api}
AI-assisted analysis of openclaw/openclaw@01804a7531 (2026-08-12).
Data as JSON: /api/errors/894d0eb2501e44d4.
Report an issue: GitHub.