YonghaoZhao722

Fix Claude Code's "Invalid signature in thinking block" error when switching models

17
0
85% credibility
Found May 30, 2026 at 17 stars -- GitGems finds repos before they trend. Get early access to the next one.
Sign Up Free
AI Analysis
TypeScript
AI Summary

A utility tool that repairs Claude Code conversation sessions by removing thinking blocks from third-party AI models, allowing users to switch between different AI providers without breaking their conversation history.

How It Works

1
😰 Your Claude Code session breaks

You try to continue a conversation but get an error about invalid signatures, usually after switching between different AI models.

2
🔍 You discover a fix exists

Someone tells you about a tool that can clean up your broken session files and remove the problematic parts.

3
📊 You scan your sessions to find the problem

The tool checks your conversation files and shows you exactly which parts are causing the issue.

4
You choose how to clean up
👁️
Preview first

See exactly what will change before anything is modified

Clean up directly

Remove the problematic thinking blocks right away

5
🛡️ Your files are safely backed up

Before making any changes, the tool creates a backup so you can undo everything if needed.

🎉 Your session works again

You open Claude Code and your conversation continues smoothly with official models, no more errors!

Sign up to see the full architecture

4 more

Sign Up Free

Star Growth

See how this repo grew from 17 to 17 stars Sign Up Free
Repurpose This Repo

Repurpose is a Pro feature

Generate ready-to-use prompts for X threads, LinkedIn posts, blog posts, YouTube scripts, and more -- with full repo context baked in.

Unlock Repurpose
AI-Generated Review

What is cc-sanitizer?

This is a CLI tool that fixes Claude Code sessions when you switch between third-party models and official Anthropic models. The problem: third-party providers like GLM and DeepSeek produce thinking blocks without valid Anthropic signatures, causing a cryptic "Invalid signature in thinking block" error that breaks your session. cc-sanitizer strips these invalid blocks from your session files so you can keep using official models without losing your conversation history. Built in TypeScript for Node.js 18+, it runs on all major platforms.

Why is it gaining traction?

The hook is simple: this solves a specific, frustrating error that would otherwise corrupt your session history. The CLI is thoughtfully designed with three commands (scan, strip, restore), dry-run previews so you can see changes before committing, and automatic backups by default. The `--suspect-only` flag intelligently preserves valid Anthropic signatures while targeting only the problematic blocks. You can reference sessions by bare name or ID instead of full paths, which makes it practical for regular use.

Who should use this?

Developers using Claude Code with multiple model providers will hit this error when switching between third-party and official models. Anyone maintaining long conversation histories they want to preserve will find this essential. Teams experimenting with different model providers need this as a safety net.

Verdict

This is a niche but well-targeted tool for a real pain point. At 17 stars with 0.85% credibility, it's early-stage but the documentation is thorough and the CLI interface is thoughtfully designed. If you're affected by this error, it's worth trying -- just verify backups work before running against critical sessions.

Sign up to read the full AI review Sign Up Free

Similar repos coming soon.