Skip to content

v13.3.0 worker fails with Cannot find module 'zod/v3' on fresh install — zod missing from package.json dependencies #2640

Description

@luismichelcf

Summary

After upgrading to claude-mem v13.3.0, the worker silently fails to capture any observations because worker-service.cjs requires zod/v3 but zod is not listed in the plugin's package.json dependencies. The hook pipeline appears to work (hooks fire, bun-runner.js launches), but the worker crashes immediately upon receiving the first observation event. The data directory (~/.claude-mem/) accumulates no new observations even though SessionStart, UserPromptSubmit, and PostToolUse hooks are configured in hooks/hooks.json.

Environment

  • OS: Windows 11 Pro 10.0.26200 (Git Bash)
  • Node: v25.5.0
  • Bun: 1.3.11
  • Plugin path: ~/.claude/plugins/cache/thedotmack/claude-mem/13.3.0/
  • Plugin version: 13.3.0
  • Host: Claude Code CLI (Opus 4.7)

Reproduction

  1. Fresh install of v13.3.0 (via plugin marketplace).
  2. Try to run the worker manually:
    node "$HOME/.claude/plugins/cache/thedotmack/claude-mem/13.3.0/scripts/bun-runner.js" \
         "$HOME/.claude/plugins/cache/thedotmack/claude-mem/13.3.0/scripts/worker-service.cjs" \
         status
  3. Observe:
    error: Cannot find module 'zod/v3' from 'C:\Users\Luis\.claude\plugins\cache\thedotmack\claude-mem\13.3.0\scripts\worker-service.cjs'
    Bun v1.3.11 (Windows x64)
    
  4. Also visible if you run with Node directly (fails earlier on bun:sqlite, expected — worker is Bun-only).
  5. Hooks still fire (logs/claude-mem-YYYY-MM-DD.log shows INIT_COMPLETE, PostToolUse: Bash(...) entries) but no observation rows accumulate.

Root cause

scripts/worker-service.cjs contains:

require('zod/v3')

But package.json only lists tree-sitter packages:

"dependencies": {
  "@derekstride/tree-sitter-sql": "^0.3.11",
  ... (all tree-sitter-* deps) ...
  "shell-quote": "^1.8.3"
}

No zod entry. When the plugin installer (bun/npm) runs after extraction, it pulls only the tree-sitter deps, so node_modules/zod/ never exists.

Workaround (verified working)

Add zod locally to the plugin install:

cd ~/.claude/plugins/cache/thedotmack/claude-mem/13.3.0/
bun add zod

This installs zod@4.4.3 (which exposes zod/v3 as a compatibility subpath, satisfying the import). After this:

  • Worker starts cleanly.
  • Hooks fire and successfully capture observations.
  • DB at ~/.claude-mem/claude-mem.db accumulates rows in real time.

Confirmed in our DB after the fix: 2391 total observations, with the most recent (#2389–2391) captured during the same session where the fix was applied.

Suggested fix

Add "zod": "^4.4.3" (or the version matching upstream's actual usage) to dependencies in the plugin's package.json so a fresh install ships with zod automatically.

Why this is hard to notice

  • Hooks fire visibly in logs (bun-runner reports launching the worker).
  • No error surfaces in the host UI — the worker crash happens in a separate process, and the hook returns control immediately.
  • The data dir at ~/.claude/plugins/data/claude-mem-thedotmack/ is empty (a red herring — actual data lives at ~/.claude-mem/).
  • Users only discover the silence when they try to use mem-search and get no results.

Additional notes

There's also a CAPTURE_BROKEN flag file that gets written when the worker receives an empty stdin payload (mentioned as "issue #2188"). Not sure if that's the same root cause being reported elsewhere, but on Windows + Bun 1.3.11 the zod/v3 import failure is the primary blocker — fixing it makes the worker fully functional even when the stdin issue surfaces.

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