[BUG] Error: Unknown protocol set in OTEL_EXPORTER_OTLP_METRICS_PROTOCOL

Status Fixed / completed
Maintainer reply ✓ Yes — sid374
Activity 10 comments · opened May 21, 2025 · closed Jun 27, 2025
💡 Likely answer: A maintainer (sid374, contributor) responded on this thread — see the highlighted reply below.

Environment

  • Platform (select one):
  • [x] Anthropic API
  • [ ] AWS Bedrock
  • [ ] Google Vertex AI
  • [ ] Other: <!-- specify -->
  • Claude CLI version: ?
  • Operating System: macOs 10.15.5
  • Terminal: ghostty
  • Node.js v23.11.0

Bug Description

After using Claude today it said that was an upgrade so I quit and restarted Claude, but it fails with:

Error: Unknown protocol set in OTEL_EXPORTER_OTLP_METRICS_PROTOCOL or OTEL_EXPORTER_OTLP_PROTOCOL env var: undefined
    at jT5 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1453:6529)
    at xT5 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1453:7131)
    at file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1453:7874

Steps to Reproduce

  1. Upgrade claude
  2. run claude

Expected Behaviour

No crash

Actual Behavior

crash

Additional Context

I tried deleting and reinstalling but got the same issue.

View original on GitHub ↗

10 Comments

sid374 contributor · 1 year ago

@channingwalton are you trying to use any of the open telemetry features as documented here?

Specifically do you have the following env vars set: CLAUDE_CODE_ENABLE_TELEMETRY=1 and OTEL_EXPORTER_OTLP_METRICS_PROTOCOL or OTEL_EXPORTER_OTLP_PROTOCOL

channingwalton · 1 year ago
@channingwalton are you trying to use any of the open telemetry features as documented here?

No, I ran claude successfully, it said there was an update and to restart, so I did, and the result was this bug.

channingwalton · 1 year ago

Sorry I do have the following set

  "env": {
    "CLAUDE_CODE_ENABLE_TELEMETRY": "1",
    "OTEL_METRICS_EXPORTER": "otlp"
  }

Deleting that has resolved the problem.

But as I say it did work prior to the upgrade.

channingwalton · 1 year ago

BTW, that doc link seems to be an internal anthropic url

sid374 contributor · 1 year ago

Thanks, fixed the link. Glad you are unblocked now, and we'll look into a possible regression.

Also curious what your use case for setting up OTEL was?

channingwalton · 1 year ago
Also curious what your use case for setting up OTEL was?

I really don't recall doing it, I must have copied it from somewhere blindly.

channingwalton · 1 year ago

Found it, I copied it from the settings docs.

diegonix · 1 year ago

I hit this problem Today, after claude updated to 1.0.31; Nothing was changed in my development environment.

I have to follow these steps to make it work again:

You can make your OpenTelemetry configuration permanent by adding it to your Claude Code settings file. Here's how:
Add the environment variables to your user settings file at ~/.claude/settings.json:

{
  "env": {
    "CLAUDE_CODE_ENABLE_TELEMETRY": "1",
    "OTEL_METRICS_EXPORTER": "otlp",
    "OTEL_EXPORTER_OTLP_PROTOCOL": "grpc",
    "OTEL_EXPORTER_OTLP_ENDPOINT": "http://localhost:4317"
  }
}

This will apply these settings every time you run Claude Code.
For project-specific settings, you can add them to .claude/settings.json in your project directory.
If you're an administrator configuring for multiple users, you can set these in the managed settings file:
macOS: /Library/Application Support/ClaudeCode/managed-settings.json
Linux: /etc/claude-code/managed-settings.json

Source: https://docs.anthropic.com/en/docs/claude-code/monitoring-usage

kushal-thakkar · 1 year ago

This issue seems resolved. Closing this - feel free to reopen if you encounter this again

github-actions[bot] · 1 year ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.