Skip to content

Instantly share code, notes, and snippets.

@giangthb
giangthb / fix-thinking-blocks.py
Created April 16, 2026 08:07
OCPlatform recovery: fix Anthropic 'thinking blocks cannot be modified' stuck sessions
#!/usr/bin/env python3
"""
fix-thinking-blocks.py — Fix Anthropic "thinking blocks cannot be modified" error
TRIỆU CHỨNG:
- User gửi message vào chat (Discord/Telegram/Webchat) nhưng assistant trả response rỗng
- Stop reason = "error", content = []
- Error 400 từ Anthropic API với message:
"messages.X.content.Y: `thinking` or `redacted_thinking` blocks in the
latest assistant message cannot be modified. These blocks must remain