[GH-ISSUE #68] Stop hook exits with error code when task is incomplete (normal state) #43

Closed
opened 2026-03-03 18:50:14 +03:00 by kerem · 1 comment
Owner

Originally created by @haimat on GitHub (Feb 4, 2026).
Original GitHub issue: https://github.com/OthmanAdi/planning-with-files/issues/68

Description

The check-complete.sh stop hook exits with code 1 when not all phases in task_plan.md are marked complete. This causes Claude Code to display an error:

● Ran 1 stop hook                                    
  ⎿  Stop hook error: Failed with non-blocking status code: No stderr output

The problem: An incomplete task is a normal state — users frequently pause work, switch contexts, or end sessions mid-task. The stop hook should report status, not fail.

Steps to reproduce

  1. Install planning-with-files skill
  2. Create a task_plan.md with multiple phases
  3. Mark at least one phase as **Status:** in_progress or **Status:** pending
  4. End the conversation or run /clear
  5. Observe the stop hook error

Verification: When all phases are marked **Status:** complete, the error disappears.

Expected behavior

Hook reports completion status (informational) and exits 0.

Actual behavior

Hook exits 1, causing Claude Code to display an error message.

Root cause

In scripts/check-complete.sh lines 36-44:

if [ "$COMPLETE" -eq "$TOTAL" ] && [ "$TOTAL" -gt 0 ]; then
    echo "ALL PHASES COMPLETE"
    exit 0
else
    echo "TASK NOT COMPLETE"
    exit 1   # <-- Triggers error in Claude Code
fi

Suggested fix

Always exit 0, use stdout for status reporting:

if [ "$COMPLETE" -eq "$TOTAL" ] && [ "$TOTAL" -gt 0 ]; then
    echo "✓ ALL PHASES COMPLETE"
else
    echo "⏳ Task in progress ($COMPLETE/$TOTAL phases complete)"
fi
exit 0

Environment

  • OS: Linux (Ubuntu)
  • Claude Code: Latest
  • planning-with-files: v2.10.0
Originally created by @haimat on GitHub (Feb 4, 2026). Original GitHub issue: https://github.com/OthmanAdi/planning-with-files/issues/68 ## Description The `check-complete.sh` stop hook exits with code 1 when not all phases in `task_plan.md` are marked complete. This causes Claude Code to display an error: ``` ● Ran 1 stop hook ⎿ Stop hook error: Failed with non-blocking status code: No stderr output ``` **The problem:** An incomplete task is a *normal state* — users frequently pause work, switch contexts, or end sessions mid-task. The stop hook should report status, not fail. ## Steps to reproduce 1. Install planning-with-files skill 2. Create a `task_plan.md` with multiple phases 3. Mark at least one phase as `**Status:** in_progress` or `**Status:** pending` 4. End the conversation or run `/clear` 5. Observe the stop hook error **Verification:** When all phases are marked `**Status:** complete`, the error disappears. ## Expected behavior Hook reports completion status (informational) and exits 0. ## Actual behavior Hook exits 1, causing Claude Code to display an error message. ## Root cause In `scripts/check-complete.sh` lines 36-44: ```bash if [ "$COMPLETE" -eq "$TOTAL" ] && [ "$TOTAL" -gt 0 ]; then echo "ALL PHASES COMPLETE" exit 0 else echo "TASK NOT COMPLETE" exit 1 # <-- Triggers error in Claude Code fi ``` ## Suggested fix Always exit 0, use stdout for status reporting: ```bash if [ "$COMPLETE" -eq "$TOTAL" ] && [ "$TOTAL" -gt 0 ]; then echo "✓ ALL PHASES COMPLETE" else echo "⏳ Task in progress ($COMPLETE/$TOTAL phases complete)" fi exit 0 ``` ## Environment - OS: Linux (Ubuntu) - Claude Code: Latest - planning-with-files: v2.10.0
kerem closed this issue 2026-03-03 18:50:14 +03:00
Author
Owner

@OthmanAdi commented on GitHub (Feb 4, 2026):

The fix has been applied to master — thanks @haimat for this report!

Scripts now always exit 0. Status is reported via stdout:

  • [planning-with-files] ALL PHASES COMPLETE (3/3)
  • [planning-with-files] Task in progress (1/3 phases complete)
  • [planning-with-files] No task_plan.md found — no active planning session.

No more "Stop hook error" in Claude Code.

<!-- gh-comment-id:3849596917 --> @OthmanAdi commented on GitHub (Feb 4, 2026): The fix has been applied to master — thanks @haimat for this report! Scripts now always exit 0. Status is reported via stdout: - `[planning-with-files] ALL PHASES COMPLETE (3/3)` - `[planning-with-files] Task in progress (1/3 phases complete)` - `[planning-with-files] No task_plan.md found — no active planning session.` No more "Stop hook error" in Claude Code.
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/planning-with-files#43
No description provided.