[BUG] Running /compact corrupts the session "API Error: 400 messages.1.content: Input should be a valid list"

Status Open
Reported on v2.1.294
Maintainer reply None cached
Activity 0 comments · opened Oct 8, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

When I run /compact, all my prompts afterwards in the session return "API Error: 400 messages.1.content: Input should be a valid list". I'm unable to work in the session any more and I must create a new session.

I have tried running the latest build 2.1.294 but the behavior was the same.

Example full conversation

  Claude Code v2.1.294
  Sonnet 5.5 with xhigh effort · API Usage Billing
  @claude · ~/safety/Design


❯ Testing compaction round 5

Round 5 received. No task attached, so I've made no changes. Send the next step when you're ready.

✻ Crunched for 8s · done 10:45 AM

※ recap: This session has no real task. You sent "Testing compaction round 5" and I confirmed receipt without changing anything. Next action: send the actual task you want done in the Design workspace. (disable recaps in /config)

❯ /compact
  ⎿  Compacted (ctrl+o to see full summary)

❯ test

Received "test". No task attached, so I've made no changes. Send the next step when you're ready.

result: No task was given; nothing changed.

✻ Cogitated for 3s · done 10:46 AM

❯ What could cause "API Error: 400 messages.1.content: Input should be a valid list"?

The message at index 1 (the second one in the messages array) has a content that is neither a string nor a list of content blocks. The API accepts only those two forms.

Common causes:

- content is null/None or missing. This happens most often with an assistant turn that only had tool calls, or with history converted from OpenAI format, where content: null is allowed.
- A single block dict instead of a list. For example {"type": "text", "text": "..."} where it should be [{"type": "text", "text": "..."}].
- A non-serializable object in content. Examples are an SDK Message object, a number, or a generator.
- A history-rebuilding bug. Index 1 is usually the first assistant reply, or the message right after a system or summary message, so look at whatever code builds or trims the history.
- A proxy, gateway, or hook that rewrites the request. It may strip or reshape content, for example by dropping empty blocks and leaving None.
- A corrupted transcript in Claude Code. After a compaction or --resume, a message can end up with a malformed content.

To find it, log the request body just before sending and inspect messages[1]. If this is Claude Code, check the session's .jsonl transcript for a message whose content is not a string or array. Starting a fresh session usually clears it.

If you share the code or the request payload, I can point to the exact field.

✻ Cogitated for 10s · done 10:46 AM

❯ /compact
  ⎿  Compacted (ctrl+o to see full summary)

❯ test

⏺ API Error: 400 messages.1.content: Input should be a valid list

✻ Churned for 1s · done 10:49 AM

❯ test

⏺ API Error: 400 messages.1.content: Input should be a valid list

✻ Brewed for 2s · done 10:50 AM

The same issue happens with Sonnet 5.5 or Opus 5.5. I am running through Amazon Bedrock and an API key as the provider.

What Should Happen?

The conversation should continue without any errors after compaction.

Error Messages/Logs

⏺ API Error: 400 messages.1.content: Input should be a valid list

Steps to Reproduce

  1. Create a new session
  2. Enter 1-2 prompts. In the description, I asked a question about the error message that compaction causes.
  3. Run /compact.
  4. Enter a prompt. When I enter "test", I get the error.

Claude Model

Sonnet (default)

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.1.294 (Claude Code)

Platform

AWS Bedrock

Operating System

macOS

Terminal/Shell

VS Code integrated terminal

Additional Information

<img width="1049" height="1088" alt="Image" src="https://github.com/user-attachments/assets/71302dfc-1a56-4b56-89a2-7eaacaa50b39" />

View original on GitHub ↗