{"record":{"id":"0cd2f2444609f9c0","repo":"thedotmack/claude-mem","slug":"not-found-session","errorCode":"not_found","errorMessage":"session_not_found","messagePattern":"session_not_found","errorType":"http","errorClass":null,"httpStatus":404,"severity":"error","filePath":"src/server/compat/SessionsSummarizeAdapter.ts","lineNumber":122,"sourceCode":"      teamId,\n      projectId,\n      contentSessionId: data.contentSessionId,\n      platformSource,\n      agentId: null,\n      agentType: null,\n    });\n\n    const result = await this.options.endSession.end({\n      sessionId: session.id,\n      projectId,\n      teamId,\n      source: 'http_post_api_sessions_summarize',\n      apiKeyId: req.authContext?.apiKeyId ?? null,\n      actorId: null,\n      sourceAdapter: 'claude-code-compat',\n    });\n    if (!result.session) {\n      res.status(404).json({ status: 'not_found', reason: 'session_not_found' });\n      return;\n    }\n    res.json({\n      status: 'queued',\n      sessionId: session.id,\n      serverSessionId: session.id,\n      generationJobId: result.outbox?.id ?? null,\n      transport: result.enqueueState,\n    });\n  }\n\n  private asyncHandler(fn: (req: Request, res: Response) => Promise<void> | void) {\n    return (req: Request, res: Response, next: (err?: unknown) => void): void => {\n      Promise.resolve(fn(req, res)).catch(next);\n    };\n  }\n}\n","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/thedotmack/claude-mem/blob/d8bc9755e74915e5c3b999181e10a67c889bce2a/src/server/compat/SessionsSummarizeAdapter.ts#L104-L140","documentation":"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.","triggerScenarios":"POST /api/sessions/summarize with a contentSessionId that was never ingested, was ingested under a different team/project, or was deleted.","commonSituations":"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).","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"],"exampleFix":"// before\nPOST /api/sessions/summarize { contentSessionId: 'unknown-sess' }\n// after: ingest first\nPOST /api/sessions/observations { contentSessionId: 'sess_123', ... }\nPOST /api/sessions/summarize { contentSessionId: 'sess_123' }","handlingStrategy":"fallback","validationCode":"// confirm the session exists before summarizing\nconst check = await fetch(`${base}/api/sessions/${contentSessionId}`, { headers: authHeaders });\nif (check.status === 404) throw new Error(`Session ${contentSessionId} not found; ingest it first`);","typeGuard":"const sessionExists = (result) => result?.session != null;","tryCatchPattern":"// handle 404 session_not_found explicitly\nif (res.status === 404 && body.reason === 'session_not_found') {\n  throw new Error(`Unknown contentSessionId: ${payload.contentSessionId}`);\n}","preventionTips":["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"],"tags":["http","not-found","sessions","compat"],"backgroundTag":"record-not-found","analyzedSha":"d8bc9755e74915e5c3b999181e10a67c889bce2a","analyzedAt":"2026-09-17T16:40:26.182Z","contentChangedAt":"2026-09-17T16:40:26.182Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}