[BUG] --resume sessionId doesn't work in non-interactive (-p) mode
Resolved 💬 5 comments Opened May 19, 2025 by GuriK Closed May 19, 2025
Environment
- Platform (select one):
- [X] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [ ] Other: <!-- specify -->
- Claude CLI version: 0.2.120
- Operating System: macOS 15.4.1
- Terminal: iTerm2
Bug Description
Claude Code always creates new session in non-interactive mode
Steps to Reproduce
Run following commands:claude -d --verbose --output-format json -p "say '10'" Get session_id from the response.claude -d --verbose --resume SESSION_ID --output-format json -p "say '20'"claude -d --verbose --resume SESSION_ID --output-format json -p "say '30'"claude -d --verbose --resume SESSION_ID --output-format json -p "say all numbers i told you"
or at any point, you can enter interactive mode with claude --resume SESSION_ID and see history of the messages.
Actual Behavior
- Numbers aren't repeated back, but using
-cworks. - JSON output of each execution has a different
session_id. This is also true when using the-coption, even though it reuses the same session behind the scenes.
Expected Behavior
- JSON output should have same
session_id --resume SESSION_IDshould continue given session.
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗