Skip to content

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

Description

@cghart

Preflight Checklist

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

What's Wrong?

Setting a long goal via /goal 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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:hooksbugSomething isn't workinghas reproHas detailed reproduction steps

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions