Skip to content

SessionStart + PostToolUse hooks emit non-blocking stderr on fresh checkout: redirect target .remember/logs/hook-errors.log doesn't exist yet #27

@vizionik25

Description

@vizionik25

Summary

The SessionStart and PostToolUse hook commands in hooks/hooks.json redirect stderr to ${CLAUDE_PROJECT_DIR:-.}/.remember/logs/hook-errors.log using 2>>. On the first session in a fresh checkout (or any time .remember/ has been cleaned up), that path does not exist yet — the script that creates it (session-start-hook.sh, lines 57–59) hasn't run. The shell opens redirection before invoking the command, so it fails with:

/bin/sh: <project>/.remember/logs/hook-errors.log: No such file or directory

Claude Code surfaces this as a hook_non_blocking_error on SessionStart:startup and every PostToolUse firing until the directory finally exists. The inner script still runs and eventually creates the directory, so it's cosmetic — but it spams the user with repeated hook errors on first use.

Repro

  1. Fresh project dir with no .remember/.
  2. Open Claude Code session in that dir with the plugin enabled.
  3. Observe hook_non_blocking_error entries in the transcript for SessionStart:startup, PostToolUse:Read, PostToolUse:Bash, etc.

Suggested fix

Pre-create the log dir in the hook command itself so the redirect target is guaranteed to exist before `2>>` evaluates, e.g.:

```
mkdir -p "${CLAUDE_PROJECT_DIR:-.}/.remember/logs" && \
bash "${CLAUDE_PLUGIN_ROOT}/scripts/session-start-hook.sh" \
2>> "${CLAUDE_PROJECT_DIR:-.}/.remember/logs/hook-errors.log"
```

Same treatment on the PostToolUse entry.

Env

  • Claude Code 2.1.118
  • macOS (Darwin 25.4.0), zsh/bash
  • Plugin: remember@claude-plugins-official v0.5.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions