/goal Stop hook fails with "Prompt is too long" when goal text is large
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
- Start a Claude Code session in any project.
- 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.>
- Work normally for a turn or two — text generation and tool calls all succeed.
- Reach the end of a turn so that Stop fires.
- 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.
16 Comments
+1
Here is my case:
+1
+1
+1
+1
⏺ Ran 1 stop hook (ctrl+o to expand)
⎿ Stop hook error: Hook evaluator API error: Prompt is too long
+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.
I'm also facing this issue with Opus 4.7 1M with a context usage of around 50%.
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".+1
Back to Codex
+111111111
+111111
+1
Got the same error here
same for me, it's unbelievable that it hasn't been fixed for so long
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:
claude-fable-5) keeps working normally past 200k tokens, but goal evaluation dies with the familiarPrompt 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.stop_hook_summaryentries 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./goalissued 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/goalstate reported as eternally active.Suggestions, any one of which would help:
/goal(with a clear message) when the session is already past the evaluator's ceiling.Happy to provide redacted
stop_hook_summaryexcerpts with timestamps if useful.