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

  1. Drop the redacted thinking block before sending (it cannot be replayed without its signature).
  2. Persist thinkingSignature alongside redacted reasoning content so replays are valid.
  3. If the history is from an external source, filter out thinking blocks missing signatures before conversion.
  4. 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

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


AI-assisted analysis of openclaw/openclaw@01804a7531 (2026-08-12). Data as JSON: /api/errors/894d0eb2501e44d4. Report an issue: GitHub.