[BUG] Error: Unknown protocol set in OTEL_EXPORTER_OTLP_METRICS_PROTOCOL
Environment
- Platform (select one):
- [x] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [ ] Other:
- 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
- Upgrade claude
- run claude
Expected Behaviour
No crash
Actual Behavior
crash
Additional Context
I tried deleting and reinstalling but got the same issue.
@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 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.
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.
BTW, that doc link seems to be an internal anthropic url
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?
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.
Found it, I copied it from the settings docs.
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
This issue seems resolved. Closing this - feel free to reopen if you encounter this again
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.