-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Open
Description
Bug
The summarize stop hook throws an unhandled error when the session transcript .jsonl file referenced in a compacted context no longer exists:
Hook error: Error: Transcript path missing or file does not exist: C:\Users\...\<session-id>.jsonl
Root Cause
In scripts/worker-service.cjs, the Cq() function throws instead of returning gracefully when the transcript file is missing or empty:
// Current (throws):
function Cq(t,e,r=!1){
if(!t||!(0,uv.existsSync)(t))
throw new Error(`Transcript path missing or file does not exist: ${t}`);
let n=(0,uv.readFileSync)(t,"utf-8").trim();
if(!n)
throw new Error(`Transcript file exists but is empty: ${t}`);
...
}When It Happens
- A long session gets context-compacted by Claude Code.
- The compacted summary embeds the original session's
.jsonltranscript path. - When the next session ends, the stop hook tries to read that old transcript path — but the file no longer exists (it may be in a different project directory, or was cleaned up).
- The
throwsurfaces as a visible hook error to the user.
Suggested Fix
Return the empty result instead of throwing — the same shape the function returns in its happy path:
function Cq(t,e,r=!1){
if(!t||!(0,uv.existsSync)(t))
return{userMessage:"",assistantMessage:""};
let n=(0,uv.readFileSync)(t,"utf-8").trim();
if(!n)
return{userMessage:"",assistantMessage:""};
...
}This makes the hook silently skip summarization for missing/empty transcripts rather than surfacing an error to the user.
Environment
- claude-mem version: 9.1.1
- Platform: Windows 11
- Triggered by: worktree-based Claude Code sessions with context compaction
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels