claude-code - 💡(How to fix) Fix [BUG] /goal stop hook fires after every assistant turn, interrupting user mid-message

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…

Error Message

Error Messages/Logs

No error messages — the hook silently re-evaluates every turn, returning "goal not met" each time and re-blocking the session.

Root Cause

The assistant hits an obstacle and needs information from the user to proceed. The user begins typing — the stop hook fires mid-message, interrupting input. The assistant responds, the hook fires again. This repeats indefinitely. The user cannot finish a sentence because every turn triggers the evaluator.

Code Example

No error messages — the hook silently re-evaluates every turn, returning "goal not met" each time and re-blocking the session.
RAW_BUFFERClick to expand / collapse

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?

When /goal is active, the stop hook evaluator fires after every assistant response — including while the user is actively typing their next message. This creates an unrecoverable loop:

The assistant hits an obstacle and needs information from the user to proceed. The user begins typing — the stop hook fires mid-message, interrupting input. The assistant responds, the hook fires again. This repeats indefinitely. The user cannot finish a sentence because every turn triggers the evaluator.

Because the goal condition isn't met, the hook keeps blocking. The user has no way to communicate a fix to the assistant, making it impossible to actually reach the goal. The exit path (/goal stop) is not surfaced anywhere in the blocked state.

What Should Happen?

The stop hook should not interrupt the user while they are composing a message. It should only evaluate after a full user-turn + assistant-turn cycle completes with no user input pending.

At minimum, when the hook fires and blocks, the UI should surface /goal stop as an escape hatch.

Error Messages/Logs

No error messages — the hook silently re-evaluates every turn, returning "goal not met" each time and re-blocking the session.

Steps to Reproduce

  1. Start a Claude Code session in a workspace with a yarn build step that fails due to Typescript compilation errors that can't be easily solved. In my case, it was a failing import for a class that had been moved from one package to another.
  2. Run: /goal get yarn build to pass
  3. Run the build — it fails with TypeScript compilation errors
  4. Begin typing a message to tell the assistant where the missing type is defined
  5. Observe: the stop hook fires mid-message, interrupting input before you can finish
  6. Assistant responds asking for info — hook fires again immediately
  7. Session loops indefinitely; /goal stop is the only exit but is not surfaced anywhere

Claude Model

Sonnet (default)

Is this a regression?

First time I tried to use /goal - so have not experienced this in a previous version

Last Working Version

No response

Claude Code Version

2.1.156 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

Related issues:

  • #59827 — similar infinite loop symptom in a different scenario
  • #61337 — /goal blocking indefinitely via AskUserQuestion

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