Skip to content

Hook infinite retry loop on summarize event (Permission denied) #2846

Description

@HN84956371-code

Bug Description

When the claude-mem worker becomes unreachable during a session, the summarize hook enters an infinite retry loop that never stops. Each retry generates a new "Stop hook feedback" message that triggers another Claude response, which triggers another hook attempt, creating an endless cycle.

Environment

  • OS: Windows 11 Home
  • Claude Code: v2.1.169
  • claude-mem: v13.4.0
  • Shell: Bash (via Git for Windows)

Steps to Reproduce

  1. Start a Claude Code session with claude-mem installed
  2. The worker becomes unreachable (in this case due to printf: write error: Permission denied)
  3. Any tool call triggers the hook, which fails
  4. On session end/summarize, the hook retries indefinitely

Observed Behavior

The hook script fails with:

/usr/bin/bash: line 1: printf: write error: Permission denied
claude-mem worker unreachable for N consecutive hooks.

Where N increments from 1 to 33+ without stopping. The summarize event hook keeps retrying on every Claude response, creating an infinite feedback loop that makes the session unusable.

Expected Behavior

After N consecutive failures (e.g., 3-5), the hook should stop retrying for the remainder of the session, or at minimum not retry on the summarize event which creates a feedback loop.

Impact

  • Wastes API tokens (each retry triggers a Claude response)
  • Makes the session difficult to close gracefully
  • User must force-quit with Ctrl+C

Suggestion

Add a max retry cap or exponential backoff. If the worker is unreachable after N attempts, disable hooks for the rest of the session and log a single warning instead of retrying indefinitely.

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