thedotmack/claude-mem · error
not_found
not_found
Error message
session_not_found
What it means
The summarize flow looks up the session through the ingest service; when result.session is null the adapter returns HTTP 404 { status:'not_found', reason:'session_not_found' }, meaning the contentSessionId supplied does not map to any known session for the authenticated tenant.
Solutions
- Verify the contentSessionId exists and was ingested under the same team/project as the API key
- Ingest the session (POST /api/sessions/observations) before requesting a summarize
- Check for environment mismatch — dev session ID used against prod server
- Confirm the key's team/project matches the one the session was created under
Example fix
// before
POST /api/sessions/summarize { contentSessionId: 'unknown-sess' }
// after: ingest first
POST /api/sessions/observations { contentSessionId: 'sess_123', ... }
POST /api/sessions/summarize { contentSessionId: 'sess_123' } Defensive patterns
Strategy: fallback
Validate before calling
// confirm the session exists before summarizing
const check = await fetch(`${base}/api/sessions/${contentSessionId}`, { headers: authHeaders });
if (check.status === 404) throw new Error(`Session ${contentSessionId} not found; ingest it first`); Type guard
const sessionExists = (result) => result?.session != null;
Try / catch
// handle 404 session_not_found explicitly
if (res.status === 404 && body.reason === 'session_not_found') {
throw new Error(`Unknown contentSessionId: ${payload.contentSessionId}`);
} Prevention
- Always ingest observations for a session before requesting its summarize
- Use per-environment session IDs; never reuse dev IDs against prod
- Ensure the API key's team/project matches the session's tenant
- Handle 404 as a recoverable state in client workflows
When it happens
Trigger: POST /api/sessions/summarize with a contentSessionId that was never ingested, was ingested under a different team/project, or was deleted.
Common situations: Client summarizing before any observation events were ingested; cross-tenant key usage (session exists under another project); stale session IDs cached in the client after a database reset or environment switch (dev vs prod).
Understand the failure class
Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.
Related errors
AI-assisted analysis of thedotmack/claude-mem@d8bc9755e7 (2026-09-17).
Data as JSON: /api/errors/0cd2f2444609f9c0.
Report an issue: GitHub.
Appendix: source
Thrown at src/server/compat/SessionsSummarizeAdapter.ts:122
teamId,
projectId,
contentSessionId: data.contentSessionId,
platformSource,
agentId: null,
agentType: null,
});
const result = await this.options.endSession.end({
sessionId: session.id,
projectId,
teamId,
source: 'http_post_api_sessions_summarize',
apiKeyId: req.authContext?.apiKeyId ?? null,
actorId: null,
sourceAdapter: 'claude-code-compat',
});
if (!result.session) {
res.status(404).json({ status: 'not_found', reason: 'session_not_found' });
return;
}
res.json({
status: 'queued',
sessionId: session.id,
serverSessionId: session.id,
generationJobId: result.outbox?.id ?? null,
transport: result.enqueueState,
});
}
private asyncHandler(fn: (req: Request, res: Response) => Promise<void> | void) {
return (req: Request, res: Response, next: (err?: unknown) => void): void => {
Promise.resolve(fn(req, res)).catch(next);
};
}
}
View on GitHub (pinned to d8bc9755e7)