[BUG] user.email missing from OTel telemetry when Claude Code runs via claude-desktop entrypoint (non-interactive terminal)
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?
Affected versions: v2.1.78 and earlier (confirmed), v2.1.79 (likely still affected in VS Code/Cursor extensions)
Behavior:
When Claude Code is launched via the Claude Desktop app (entrypoint: claude-desktop, terminal.type: non-interactive), the OTEL metric attributes are missing user.email, user.account_uuid, and organization.id — despite the user
being authenticated via OAuth (is_claude_ai_auth: true).
Expected (per docs): user.email is documented as "Always included when available" for OAuth-authenticated users.
Root cause (inferred): C3() returns D8().oauthAccount — but when launched non-interactively via Claude Desktop, ~/.claude/.claude.json does not exist (no oauthAccount persisted), so the OTEL resource attributes are initialized before identity is available.
Confirmed working: v2.1.80 via standalone terminal (iTerm.app) — all fields present.
Steps to reproduce:
- Install Claude Desktop app on macOS
- Configure OTEL telemetry export (CLAUDE_CODE_ENABLE_TELEMETRY=1, OTEL_METRICS_EXPORTER=otlp)
- Open a Claude Code session via the Desktop app
- Observe: MetricAttributes contains user.id but NOT user.email, user.account_uuid, or organization.id
Impact: Enterprise/team telemetry dashboards cannot identify users from mac Claude Desktop sessions.
What Should Happen?
Expected (per docs): user.email is documented as "Always included when available" for OAuth-authenticated users.
Error Messages/Logs
Steps to Reproduce
Steps to reproduce:
- Install Claude Desktop app on macOS
- Configure OTEL telemetry export (CLAUDE_CODE_ENABLE_TELEMETRY=1, OTEL_METRICS_EXPORTER=otlp)
- Open a Claude Code session via the Desktop app
- Observe: MetricAttributes contains user.id but NOT user.email, user.account_uuid, or organization.id
Impact: Enterprise/team telemetry dashboards cannot identify users from mac Claude Desktop sessions.
Claude Model
Sonnet (default)
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
Affected versions: v2.1.78 and earlier (confirmed), v2.1.79 (likely still affected in VS Code/Cursor extensions)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
iTerm2
Additional Information
_No response_
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗