-
Notifications
You must be signed in to change notification settings - Fork 6.4k
Open
Labels
area:agentsbugSomething isn't workingSomething isn't workinghas reproHas detailed reproduction stepsHas detailed reproduction stepsplatform:windowsIssue specifically occurs on WindowsIssue specifically occurs on Windows
Description
Bug Description
When using the Agent tool (with subagent_type: Explore or general-purpose), the call consistently fails with:
Error: Cannot read properties of undefined (reading 'input_tokens')
All basic tools (Glob, Grep, Read, Bash, Edit, Write) work fine. Only the Agent/subagent invocations are affected.
Steps to Reproduce
- Start a Claude Code CLI session (v2.1.76)
- Trigger any task that invokes the Agent tool, e.g.:
subagent_type: Explore— for codebase explorationsubagent_type: general-purpose— for multi-step research
- The agent call fails immediately with the error above
- Retrying produces the same error every time
Expected Behavior
The subagent should launch, perform its task, and return results.
Actual Behavior
The subagent call fails instantly with:
Error: Cannot read properties of undefined (reading 'input_tokens')
No partial results are returned. The error appears to originate from response parsing logic where the API response object's usage or usage.input_tokens field is undefined.
Environment
- Claude Code version: 2.1.76 (latest on npm as of 2025-03-16)
- OS: Windows 11 Home China (10.0.26200)
- Node.js: v22.22.1
- Shell: Git Bash (MINGW64)
- Model: claude-opus-4-6
Workaround
Avoid using Agent/Explore subagents entirely. Use Glob, Grep, and Read tools directly for codebase searches. This works but loses the parallelism and autonomy benefits of subagents.
Additional Context
- The error is 100% reproducible — every Agent call fails, not intermittent.
- Network connectivity is fine (all other API calls succeed).
- This may be related to how subagent API responses are parsed — possibly a missing null check on
response.usagebefore accessinginput_tokens.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area:agentsbugSomething isn't workingSomething isn't workinghas reproHas detailed reproduction stepsHas detailed reproduction stepsplatform:windowsIssue specifically occurs on WindowsIssue specifically occurs on Windows