Bedrock streaming: undefined is not an object (evaluating '_.speed')
Bug
When using Claude Code v2.1.86 with Amazon Bedrock as the provider, the error undefined is not an object (evaluating '_.speed') fires repeatedly during streaming (mid-thinking/response), not just at startup. It appears on every streaming chunk.
Environment
- Claude Code version: 2.1.86 (latest)
- Provider: Amazon Bedrock via Teleport proxy (
CLAUDE_CODE_USE_BEDROCK=1) - Model:
us.anthropic.claude-opus-4-6-v1 - OS: macOS (Darwin 25.3.0)
- Node.js: with custom
--requirebootstrap for HTTPS proxy tunneling
Reproduction
- Configure Bedrock provider (
CLAUDE_CODE_USE_BEDROCK=1) - Launch Claude Code with a Bedrock model ID
- Send any prompt — the error appears repeatedly during streaming output
Analysis
The minified code is trying to access .speed on model metadata (_) that is undefined. The Anthropic direct API likely returns speed/performance metadata in the streaming response, but the Bedrock endpoint does not include this field, causing the property access to fail on every chunk.
Current workaround
Filtering stderr: claude --model "$MODEL" 2> >(grep -v '\.speed' >&2)
This suppresses the error messages but doesn't fix the underlying null-safety issue.
Expected behavior
Claude Code should handle missing .speed metadata gracefully when using Bedrock (e.g., optional chaining _.speed → _?.speed).