[BUG] claude -m sonnet -p "plan this project" style prompt usually hanging on an error
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
- run claude -m sonnet -p 'do planning'
- try again if it doesn't fail
- <!-- And so on... -->
Expected Behavior
do work
Actual Behavior
error displayed, and then it never completes
Additional Context
This issue has 13 comments on GitHub. Read the full discussion on GitHub ↗