The Problem

Once in a while, you will encounter an error like the following, which blocks you from further conversation with Claude Code.

claude block must have a corresponding `tool_use` block in the previous message

The Fix

You have several options:

1) End the current conversation and start a new one.

2) If you want to keep the current context, you can use the /compact command to wipe the conversation history while maintaining a summarised context.

/compact

3) If you want to save time and tokens, you can use the /rewind command and go backward 1 to 2 steps.

/rewind

If you proceed with the rewind, you will see a list of your previous steps (checkpoints). You can pick one from the list.

You can also decide to restore just the conversation, just the code, or both.

Once restored, the problematic conversation (usually the last one) would be wiped. You can continue from the previous step.


Related bug report: https://github.com/anthropics/claude-code/issues/12894