Skip to content

SessionStart hook (check-config.sh) exits 1 when no prior run, triggers Claude Code hook-failure warning #463

@anthonyjackman

Description

@anthonyjackman

Summary

The SessionStart hook hooks/scripts/check-config.sh can exit with status 1 on a normal, fully-configured session. Claude Code reports this on every session start as:

SessionStart:startup hook ... failed with non-blocking status code: no stderr output

It's non-blocking (the session is unaffected) but it surfaces a confusing error to users even though setup is correct.

Root cause

The script's final statement is:

[[ -n "$LAST_RUN_LINE" ]] && echo "$LAST_RUN_LINE"

When LAST_RUN_LINE is empty — i.e. there is no ~/.config/last30days/last-run.json yet (no prior run, or it isn't parseable) — the [[ -n "" ]] test evaluates false, the && short-circuits, and the compound command returns exit status 1. Because this is the last statement in the script, the script itself exits 1.

This affects every code path that ends on one of these [[ -n "$LAST_RUN_LINE" ]] && echo ... lines (the "fully configured" and the missing-ScrapeCreators branches), so a fully set-up user with no prior run sees the warning.

Reproduce

# fresh config, no last-run.json
printf 'set -e\n[[ -n "" ]] && echo x\n' | bash; echo "exit=$?"   # -> exit=1

Or just start a Claude Code session with last30days configured but no prior /last30days run.

Fix

Add a trailing exit 0 to the script (the hook output is purely informational, so a clean exit is always correct). Alternatively guard the final line:

{ [[ -n "$LAST_RUN_LINE" ]] && echo "$LAST_RUN_LINE"; } || true

Present in v3.3.0 and v3.3.1 (and v3.2.1 on the equivalent final line).

Environment

  • macOS (Darwin), /bin/bash 3.2
  • last30days v3.3.1 via Claude Code plugin marketplace

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions