Skip to content

[BUG] user.email missing from OTel telemetry when Claude Code runs via claude-desktop entrypoint (non-interactive terminal) #36980

Description

@valentinlupu

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • 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:

  1. Install Claude Desktop app on macOS
  2. Configure OTEL telemetry export (CLAUDE_CODE_ENABLE_TELEMETRY=1, OTEL_METRICS_EXPORTER=otlp)
  3. Open a Claude Code session via the Desktop app
  4. 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:

  1. Install Claude Desktop app on macOS
  2. Configure OTEL telemetry export (CLAUDE_CODE_ENABLE_TELEMETRY=1, OTEL_METRICS_EXPORTER=otlp)
  3. Open a Claude Code session via the Desktop app
  4. 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghas reproHas detailed reproduction stepsplatform:macosIssue specifically occurs on macOSstaleIssue is inactive

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions