claude-code - 💡(How to fix) Fix [Bug] Subagent spawning fails with xhigh/max reasoning due to prompt length limits [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#56099Fetched 2026-05-05 05:58:15
View on GitHub
Comments
1
Participants
2
Timeline
7
Reactions
0
Author
Timeline (top)
labeled ×4closed ×1commented ×1renamed ×1

Error Message

[{"error":"Error: NON-FATAL: Lock acquisition failed for /Users/pz/.local/share/claude/versions/2.1.126 (expected in multi-process scenarios)\n at r86 (/$bunfs/root/src/entrypoints/cli.js:2768:2177)\n at HD8 (/$bunfs/root/src/entrypoints/cli.js:2768:1257)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-05-04T18:55:15.252Z"},{"error":"Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"prompt is too long: 213350 tokens > 200000 maximum"},"request_id":"req_011Cai3T9vQmUgHA5Kf7Jgi1"}\n at generate (/$bunfs/root/src/entrypoints/cli.js:11:57327)\n at makeRequest (/$bunfs/root/src/entrypoints/cli.js:50:4943)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-05-04T18:59:33.796Z"},{"error":"Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"prompt is too long: 213350 tokens > 200000 maximum"},"request_id":"req_011Cai3TxgG6i4uPJigd97K1"}\n at generate (/$bunfs/root/src/entrypoints/cli.js:11:57327)\n at makeRequest (/$bunfs/root/src/entrypoints/cli.js:50:4943)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-05-04T18:59:45.199Z"},{"error":"Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"prompt is too long: 213350 tokens > 200000 maximum"},"request_id":"req_011Cai3UZ3Ut91sdDsf11NQB"}\n at generate (/$bunfs/root/src/entrypoints/cli.js:11:57327)\n at makeRequest (/$bunfs/root/src/entrypoints/cli.js:50:4943)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-05-04T18:59:53.050Z"}]

Root Cause

Bug Description when using xhigh or max, unable to spawn subagents because of prompt hit length limits: ⏺ Explore(Find auto-save client code) Done (0 tool uses · 0 tokens · 1s)

Code Example

[{"error":"Error: NON-FATAL: Lock acquisition failed for /Users/pz/.local/share/claude/versions/2.1.126 (expected in multi-process scenarios)\n    at r86 (/$bunfs/root/src/entrypoints/cli.js:2768:2177)\n    at HD8 (/$bunfs/root/src/entrypoints/cli.js:2768:1257)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-05-04T18:55:15.252Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 213350 tokens > 200000 maximum\"},\"request_id\":\"req_011Cai3T9vQmUgHA5Kf7Jgi1\"}\n    at generate (/$bunfs/root/src/entrypoints/cli.js:11:57327)\n    at makeRequest (/$bunfs/root/src/entrypoints/cli.js:50:4943)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-05-04T18:59:33.796Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 213350 tokens > 200000 maximum\"},\"request_id\":\"req_011Cai3TxgG6i4uPJigd97K1\"}\n    at generate (/$bunfs/root/src/entrypoints/cli.js:11:57327)\n    at makeRequest (/$bunfs/root/src/entrypoints/cli.js:50:4943)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-05-04T18:59:45.199Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 213350 tokens > 200000 maximum\"},\"request_id\":\"req_011Cai3UZ3Ut91sdDsf11NQB\"}\n    at generate (/$bunfs/root/src/entrypoints/cli.js:11:57327)\n    at makeRequest (/$bunfs/root/src/entrypoints/cli.js:50:4943)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-05-04T18:59:53.050Z"}]
RAW_BUFFERClick to expand / collapse

Bug Description when using xhigh or max, unable to spawn subagents because of prompt hit length limits: ⏺ Explore(Find auto-save client code) Done (0 tool uses · 0 tokens · 1s)

⏺ Explore(Find server auto-save handlers) Done (0 tool uses · 0 tokens · 1s)

⏺ Explore(Find Sentry config + scrubbing) Done (0 tool uses · 0 tokens · 1s)

Subagent prompts hit length limits. Investigating directly.

Environment Info

  • Platform: darwin
  • Terminal: ghostty
  • Version: 2.1.126
  • Feedback ID: 01a092a7-3dcc-4567-a901-f55711e45104

Errors

[{"error":"Error: NON-FATAL: Lock acquisition failed for /Users/pz/.local/share/claude/versions/2.1.126 (expected in multi-process scenarios)\n    at r86 (/$bunfs/root/src/entrypoints/cli.js:2768:2177)\n    at HD8 (/$bunfs/root/src/entrypoints/cli.js:2768:1257)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-05-04T18:55:15.252Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 213350 tokens > 200000 maximum\"},\"request_id\":\"req_011Cai3T9vQmUgHA5Kf7Jgi1\"}\n    at generate (/$bunfs/root/src/entrypoints/cli.js:11:57327)\n    at makeRequest (/$bunfs/root/src/entrypoints/cli.js:50:4943)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-05-04T18:59:33.796Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 213350 tokens > 200000 maximum\"},\"request_id\":\"req_011Cai3TxgG6i4uPJigd97K1\"}\n    at generate (/$bunfs/root/src/entrypoints/cli.js:11:57327)\n    at makeRequest (/$bunfs/root/src/entrypoints/cli.js:50:4943)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-05-04T18:59:45.199Z"},{"error":"Error: 400 {\"type\":\"error\",\"error\":{\"type\":\"invalid_request_error\",\"message\":\"prompt is too long: 213350 tokens > 200000 maximum\"},\"request_id\":\"req_011Cai3UZ3Ut91sdDsf11NQB\"}\n    at generate (/$bunfs/root/src/entrypoints/cli.js:11:57327)\n    at makeRequest (/$bunfs/root/src/entrypoints/cli.js:50:4943)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-05-04T18:59:53.050Z"}]

extent analysis

TL;DR

Reduce the prompt length to below 200,000 tokens to avoid hitting the length limit when spawning subagents.

Guidance

  • Identify the specific prompts causing the length limit issue and consider shortening them or splitting the tasks into smaller, more focused prompts.
  • Review the auto-save client code, server auto-save handlers, and Sentry config to ensure they are not contributing to the excessive prompt length.
  • Investigate if there are any configuration options or parameters that can be adjusted to increase the prompt length limit, although this may not be feasible given the error messages.

Example

No specific code snippet can be provided without more context, but the goal would be to refactor the prompts to be more concise, such as focusing on specific aspects of the auto-save functionality or error handling.

Notes

The issue seems to be directly related to the prompt length exceeding the maximum allowed limit of 200,000 tokens. The provided error messages consistently point to this issue, suggesting that addressing the prompt length will resolve the problem.

Recommendation

Apply workaround: Reduce the prompt length to comply with the 200,000 token limit, as directly addressing the root cause (the limit itself) may not be feasible without further modifications to the system or its configuration.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [Bug] Subagent spawning fails with xhigh/max reasoning due to prompt length limits [1 comments, 2 participants]