[BUG] claude -p returns session_id but writes no transcript; immediate --resume fails (2.1.209 and 2.1.210, Linux)
Summary
claude -p completes successfully and returns a session_id, but writes no transcript for that session. An immediate claude -p --resume <session-id> fails with No conversation found with session ID.
This reproduces with both Claude Code 2.1.209 and 2.1.210 on Linux. It closely matches #40609, which was closed as stale without a confirmed fix.
Reproduction
From an existing trusted Git repository:
claude -p --output-format json 'Reply with exactly: test'
The command succeeds and returns test plus a session ID. For example:
"result":"test"
"session_id":"e8c7c4b7-673a-4221-b554-8628d1297e98"
No transcript or reference containing that ID exists afterward:
rg -l --hidden 'e8c7c4b7-673a-4221-b554-8628d1297e98' ~/.claude
find ~/.claude/projects -type f -name 'e8c7c4b7-673a-4221-b554-8628d1297e98.jsonl'
Both commands produce no output.
Immediate resume fails:
claude -p --output-format json \
--resume e8c7c4b7-673a-4221-b554-8628d1297e98 \
'Reply with exactly: resumed'
No conversation found with session ID: e8c7c4b7-673a-4221-b554-8628d1297e98
Additional isolation
- Reproduced on 2.1.210.
- Downgraded with
claude install 2.1.209; the same minimal reproduction still failed. - Restored 2.1.210 afterward.
- Reproduced with plain JSON output and with
--json-schemastructured output. - Supplying a fresh UUID through
--session-iddoes not create a transcript either. --no-session-persistencewas not passed.- Neither
CLAUDE_CODE_SKIP_PROMPT_HISTORYnor any otherCLAUDE_*/ANTHROPIC_*environment variable is set. - No
cleanupPeriodDays, session-persistence, or prompt-history override exists in the local Claude JSON configuration. - Normal interactive Claude sessions on the same machine have persisted transcript files under
~/.claude/projects/<project>/<session-id>.jsonl.
Expected behavior
Print-mode sessions persist by default and can be resumed programmatically with claude -p --resume <session-id>. Only --no-session-persistence should disable this.
Actual behavior
Claude returns a session ID for a successfully completed print-mode invocation, but no corresponding on-disk session exists and the returned ID cannot be resumed.
Environment
- Claude Code: reproduced on 2.1.209 and 2.1.210, native installation
- OS: Fedora Linux 44 Workstation, x86_64
- Kernel: 7.0.13-200.fc44.x86_64
- Installation path:
~/.local/bin/claude - Authentication: Claude subscription login
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗