claude-code - 💡(How to fix) Fix Agent/subagent spawn fails with 'Prompt is too long' even for tiny prompts (large MCP tool set)

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…

Spawning a subagent via the Agent / Task tool fails immediately with Prompt is too long — even when the prompt I pass is one or two short sentences. The failure is independent of my prompt length: shrinking a ~400-word prompt down to a single sentence ("Map the Omnibar in this iOS app...") still returns Prompt is too long. It appears the subagent's inherited context (system prompt + the very large enumerated/deferred tool list) already exceeds the subagent model's context window before my prompt is appended, so no prompt is small enough to succeed.

Error Message

A short subagent prompt should spawn successfully. If the inherited tool/context payload is what's over the limit, the error should say so (e.g. "subagent context exceeds model limit; reduce connected MCP tools") rather than blaming the user-supplied "prompt", which is misleading and un-actionable. Ideally the subagent should also inherit the parent's large context window (the parent was on a 1M-context model) and/or only load deferred tool schemas on demand rather than eagerly. The subagent is initialized with the full tool catalog (including the large set of MCP tools surfaced as deferred tools) baked into its context, and/or is started on a model/context-window smaller than the parent's, so the baseline context already overflows before any user prompt is added. The error message attributes this to the "prompt," which masks the real cause.

Root Cause

Spawning a subagent via the Agent / Task tool fails immediately with Prompt is too long — even when the prompt I pass is one or two short sentences. The failure is independent of my prompt length: shrinking a ~400-word prompt down to a single sentence ("Map the Omnibar in this iOS app...") still returns Prompt is too long. It appears the subagent's inherited context (system prompt + the very large enumerated/deferred tool list) already exceeds the subagent model's context window before my prompt is appended, so no prompt is small enough to succeed.

RAW_BUFFERClick to expand / collapse

Summary

Spawning a subagent via the Agent / Task tool fails immediately with Prompt is too long — even when the prompt I pass is one or two short sentences. The failure is independent of my prompt length: shrinking a ~400-word prompt down to a single sentence ("Map the Omnibar in this iOS app...") still returns Prompt is too long. It appears the subagent's inherited context (system prompt + the very large enumerated/deferred tool list) already exceeds the subagent model's context window before my prompt is appended, so no prompt is small enough to succeed.

Repro

  1. Run Claude Code in a session with many MCP servers connected (in my case: Datadog, Figma, Linear, Slack, Sentry, Notion, GitHub, PostHog, Intercom, Granola, Google, etc. — a very large deferred-tool list shown in the system reminder).
  2. Main model is Opus 4.8 (1M context).
  3. Call the Agent tool with subagent_type: "Explore" and a short prompt.
  4. Observe the tool result: Prompt is too long.
  5. Reduce the prompt to a single short sentence and retry → still Prompt is too long.
  6. Launching 3 in parallel, then 1 alone — same result every time.

Expected

A short subagent prompt should spawn successfully. If the inherited tool/context payload is what's over the limit, the error should say so (e.g. "subagent context exceeds model limit; reduce connected MCP tools") rather than blaming the user-supplied "prompt", which is misleading and un-actionable. Ideally the subagent should also inherit the parent's large context window (the parent was on a 1M-context model) and/or only load deferred tool schemas on demand rather than eagerly.

Impact

Plan mode strongly steers toward using Explore/Plan subagents for codebase research; when every spawn fails, the whole subagent-based workflow is unusable and you have to fall back to doing all searching inline in the main loop.

Environment

  • Claude Code CLI (terminal)
  • Model: claude-opus-4-8 (1M context) as main loop
  • OS: macOS (Darwin 25.5.0)
  • Many MCP servers connected (large deferred tool list)
  • Subagent types attempted: Explore (likely affects all types)

Hypothesis

The subagent is initialized with the full tool catalog (including the large set of MCP tools surfaced as deferred tools) baked into its context, and/or is started on a model/context-window smaller than the parent's, so the baseline context already overflows before any user prompt is added. The error message attributes this to the "prompt," which masks the real cause.

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 Agent/subagent spawn fails with 'Prompt is too long' even for tiny prompts (large MCP tool set)