fix: fp-check Stop hooks return JSON instead of plain text#137
Open
bluzername wants to merge 1 commit intotrailofbits:mainfrom
Open
fix: fp-check Stop hooks return JSON instead of plain text#137bluzername wants to merge 1 commit intotrailofbits:mainfrom
bluzername wants to merge 1 commit intotrailofbits:mainfrom
Conversation
|
|
vishalverma8200
approved these changes
Mar 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The fp-check plugin's Stop and SubagentStop hooks cause "JSON validation failed" error every time Claude Code exits a session. The hooks use
type: "prompt"which expects the LLM to return structured JSON, but the prompt instructions tell it to return plain text like'approve'or'block'.I was getting this error on every session exit after installing fp-check and it was confusing because the plugin wasnt even being used in those sessions.
Root Cause
In
plugins/fp-check/hooks/hooks.json, both hooks have prompts ending with:But Claude Code expects prompt-type hooks to return valid JSON like:
{"decision": "approve"}Fix
Updated the return instructions in both hooks to ask for JSON format:
Stop hook (line 10):
SubagentStop hook (line 22):
Same pattern.
Also added
IMPORTANT: Return valid JSON only, no text outside the JSON object.to both prompts to make sure the LLM doesnt add extra text around the JSON.Impact
This error happens on EVERY session exit when fp-check is installed, even for sessions that have nothing to do with false positive verification. The fix makes both hooks return proper JSON so Claude Code can parse the response correctly.
Closes #131