[BUG] `CLAUDE_SESSION_ID` not found in env
Status Closed — not planned
Reported on v2.1.37
Maintainer reply None cached
Activity 4 comments · opened Feb 9, 2026 · closed Mar 25, 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?
CLAUDE_SESSION_ID seems to be no longer available in the main agent context.
❯ What is CLAUDE_SESSION_ID?
⏺ CLAUDE_SESSION_ID is a built-in environment variable provided by Claude Code that contains a unique identifier for the current conversation/session. It's a UUID that stays
constant throughout a single conversation but changes when a new conversation starts.
You can see its current value:
⏺ Bash(echo $CLAUDE_SESSION_ID)
⎿ (No content)
⏺ Interesting — it's empty in this shell context. Let me check how it's typically available:
⏺ Bash(env | grep -i claude)
⎿ CLAUDE_CODE_SSE_PORT=32421
CLAUDE_CODE_ENTRYPOINT=cli
CLAUDECODE=1
What Should Happen?
CLAUDE_SESSION_ID should be exported and available.
Error Messages/Logs
Steps to Reproduce
- start claude:
claude - ask for
CLAUDE_SESSION_ID
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.37
Platform
Other
Operating System
macOS
Terminal/Shell
iTerm2
Additional Information
_No response_
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗