---
title: 'API Error: claude block must have a corresponding `tool_use` block in the previous message'
url: https://calvin.my/posts/api-error-claude-block-must-have-a-corresponding-tool_use-block-in-the-previous-message
published: 2025-12-02
updated: 2026-09-16
category: AI
tags:
- Claude
- Anthropic
- Claude Code
summary: This post addresses a Claude Code API error that prevents further conversation when a Claude block lacks a matching prior tool-use block. Suggested recovery options are starting a new session, compacting history while retaining a summary of context, or rewinding one or two checkpoints. Rewind lets users restore conversation history, code changes, or both, removing the problematic recent exchange and allowing work to continue.
---

# API Error: claude block must have a corresponding `tool_use` block in the previous message

## The Problem

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

```bash
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.

   ```bash
   /compact
   ```

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

   ```bash
   /rewind
   ```

* * *
## About rewind

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

   ![](https://camy-pub.s3.ap-southeast-1.amazonaws.com/84eed4a6-229c-40a5-a117-ad51ce963574.png)

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

   ![](https://camy-pub.s3.ap-southeast-1.amazonaws.com/d664ef1f-d917-47a0-8c72-007fd56e98a8.png)

3. 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
