[BUG] claude -m sonnet -p "plan this project" style prompt usually hanging on an error

Resolved 💬 13 comments Opened Jun 6, 2025 by willer Closed Jul 12, 2025

Environment

  • Platform (select one):
  • [ ] Anthropic API
  • [ ] AWS Bedrock
  • [ ] Google Vertex AI
  • [ x ] Other: Claude Max
  • Claude CLI version: 1.0.16
  • Operating System: macOS 15.4.1
  • Terminal: iTerm2

Bug Description

I have a script that calls claude-p to plan the next task, then again to do dev, then a third time to review the code. The first part, the planner, has been hanging most of the time lately (not always) on a particular error. I don't know what it's doing at that time; it could be running a build or something?

==================================================================
This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
Error: Expected content to be an assistant message, but got "user"
at yS2 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:2342:9744)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async bE5 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:2356:8265)

Steps to Reproduce

  1. run claude -m sonnet -p 'do planning'
  2. try again if it doesn't fail
  3. <!-- And so on... -->

Expected Behavior

do work

Actual Behavior

error displayed, and then it never completes

Additional Context

View original on GitHub ↗

This issue has 13 comments on GitHub. Read the full discussion on GitHub ↗