/goal Stop hook fails with "Prompt is too long" when goal text is large

Open 💬 16 comments Opened May 12, 2026 by cghart

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Setting a long goal via /goal <text> installs a session-scoped Stop hook whose condition is the entire goal text verbatim. On every Stop, the hook evaluator
re-sends that text to the model. If the goal is long enough, the evaluator rejects it with:

Hook evaluator API error: Prompt is too long

Once this state is reached, the turn cannot Stop cleanly until the goal is cleared.

What Should Happen?

Either:

  • /goal rejects or truncates input that would exceed the Stop-hook evaluator's prompt budget, with a clear message at set time; or
  • The Stop-hook evaluator handles an oversized condition gracefully (skip, warn, or summarise) instead of blocking Stop.

The Stop hook should never become unable to evaluate itself because the user provided a long goal.

Error Messages/Logs

Hook evaluator API error: Prompt is too long

Steps to Reproduce

  1. Start a Claude Code session in any project.
  2. Run /goal with a long multi-paragraph argument. A reliable repro is to paste ~30+ lines including file paths, a plan pointer, and a paragraph of constraints

— for example:
/goal Please work from this handoff plan:

/path/to/docs/superpowers/plans/<long-plan-name>.md

Repo path:

/path/to/repo

Goal: <several lines of overarching aim>

<several more lines of constraints, directives, "do not do X",
"start with Task 1 then Task 2", etc.>

  1. Work normally for a turn or two — text generation and tool calls all succeed.
  2. Reach the end of a turn so that Stop fires.
  3. The Stop hook errors with Hook evaluator API error: Prompt is too long and blocks the Stop. Subsequent Stops repeat the same error.

Workaround that recovers cleanly: /goal clear. After clearing, Stop works again. Short single-sentence goals do not trigger the bug.

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.139

Platform

Anthropic API

Operating System

Ubuntu/Debian Linux

Terminal/Shell

Terminal.app (macOS)

Additional Information

  • The failure depends only on the length of the /goal argument, not on the project, the tools used, or the model's responses during the turn.
  • Likely root cause: the Stop hook's evaluator prompt includes the literal goal-condition text on every Stop, so the evaluator's prompt grows proportionally to

the goal length. Once the condition pushes the evaluator over its own context budget, every Stop fails identically.

  • Suggested fix direction: either cap /goal argument length at set time with a friendly error, or have the Stop-hook evaluator fall back to a compact

representation (hash + truncated preview) when the literal condition would exceed budget.

View original on GitHub ↗

16 Comments

andreuka · 2 months ago

+1

dttran-glo · 2 months ago

Here is my case:

Ran 2 stop hooks
  ⎿  Stop hook error: Hook evaluator API error: Prompt is too long
dhqdbb · 2 months ago

+1

PivotalRD · 2 months ago

+1

ETdoFresh · 2 months ago

+1

nRewik · 2 months ago

+1

⏺ Ran 1 stop hook (ctrl+o to expand)
⎿  Stop hook error: Hook evaluator API error: Prompt is too long

dbabokin · 1 month ago

+1

Claude Code version: 2.1.145

My sessions are pretty long (up to 18h) and may compact (1M context) several times before this error happens. But once I hit, the chances to hit it again are pretty high, despite manual context compaction. I resume after that with either "resume" or "continue plan execution" prompt.

cferreira-fuze · 1 month ago

I'm also facing this issue with Opus 4.7 1M with a context usage of around 50%.

cortesi · 1 month ago

This makes it effectively impossible to have Claude iterate independently. Unbelievable that it's unfixed for two weeks. I'll also note that I see this message even with very short /goal prompts if they reference a file through @path, e.g. "implement @spec.md".

Rhiz3K · 1 month ago

+1
Back to Codex

Tai7sy · 1 month ago

+111111111

killaragorn · 1 month ago

+111111

taiwong148960 · 1 month ago

+1

GaryLiuGTA · 1 month ago

Got the same error here

xyn24 · 1 month ago

same for me, it's unbelievable that it hasn't been fixed for so long

kristofferv98 · 2 days ago

Adding an independently reproduced evidence set from a long-running 1M-context session (Claude Code 2.1.x, macOS arm64), since it confirms the mechanism here and adds a facet I haven't seen documented yet: on headless/tmux-driven sessions this failure is completely silent.

What we observed:

  1. The cap binds the evaluator call, not the session model. A 1M-context session (claude-fable-5) keeps working normally past 200k tokens, but goal evaluation dies with the familiar Prompt is too long: N > 200000 — consistent with what others reported (#61759, #62345). The default Haiku evaluator isn't the limiting factor; the fixed 200k ceiling on the evaluation call is.
  1. The transcript shows a precise silent-death signature. Comparing stop_hook_summary entries across the session: the goal-evaluator hook simply disappears from the hook set once context passes ~200k (six hooks become five). The last successful verdict landed at ≈200k tokens. No error row appears anywhere in the transcript.
  1. A goal set past the cap is dead from birth. A /goal issued at ~325k tokens never received a single evaluation — while still firing turns normally, so the session behaves goaled with no met-detection, no auto-clear, and /goal state reported as eternally active.
  1. The error surfaces only in the terminal UI. Sessions driven headless or in tmux (agent fleets, CI-style automation) get zero signal: no transcript row, no hook event, nothing programmatically observable. Downstream tooling that reads goal state has no way to distinguish "goal active" from "evaluator dead".

Suggestions, any one of which would help:

  • Window/summarize the transcript for the evaluator call instead of sending the whole conversation;
  • or surface evaluator failure as a transcript-visible row / hook event so non-interactive setups can react;
  • or refuse /goal (with a clear message) when the session is already past the evaluator's ceiling.

Happy to provide redacted stop_hook_summary excerpts with timestamps if useful.