thedotmack/claude-mem · error
error
error
Error message
internal_error
What it means
The compat summarize adapter wraps summarizeSession in try/catch and returns HTTP 500 { status:'error', reason:'internal_error' } for any unexpected failure during the summarize/ingest pipeline. The specific cause is only in the server logs under 'compat summarize adapter failed'.
Solutions
- Check server logs for 'compat summarize adapter failed' to identify the real exception
- Retry after verifying database and summarize-service health
- Inspect the payload for null fields (contentSessionId) that may crash downstream code
- Add explicit error mapping in the adapter instead of the blanket catch
Example fix
// server log
// before: { status:'error', reason:'internal_error' }
// after: include stack and payload in the log line
logger.error('SYSTEM', 'compat summarize adapter failed', { error: err.message, stack: err.stack, payload: parsed.data }); Defensive patterns
Strategy: retry
Validate before calling
if (!payload.contentSessionId) throw new Error('contentSessionId required before summarize'); Type guard
const hasSessionId = (p) => typeof p?.contentSessionId === 'string' && p.contentSessionId.length > 0;
Try / catch
// retry transient 500s, escalate persistent ones
if (res.status === 500 && body.reason === 'internal_error') {
if (attempt < 3) return retryWithBackoff(attempt + 1);
throw new Error(`Summarize failed persistently: ${await res.text()}`);
} Prevention
- Alert on 'compat summarize adapter failed' log entries
- Verify DB and summarize-service health checks pass before deploys
- Log the underlying error stack inside the adapter catch block
- Add end-to-end tests for the summarize compat path
When it happens
Trigger: Any exception thrown inside summarizeSession — database write failure, IngestEventsService/summarize service rejection, unexpected null in the parsed payload — after validation and auth checks pass.
Common situations: DB outages or migration drift; summarize service dependency failure (e.g. summarizer queue down); regressions in the compat translation layer after refactors.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
AI-assisted analysis of thedotmack/claude-mem@d8bc9755e7 (2026-09-17).
Data as JSON: /api/errors/046950074d865b64.
Report an issue: GitHub.
Appendix: source
Thrown at src/server/compat/SessionsSummarizeAdapter.ts:85
return;
}
// Subagent contexts in legacy code emit summarize calls but the worker
// skipped them. We preserve the legacy semantics so existing clients
// see the same response shape.
if (parsed.data.agentId) {
res.json({ status: 'skipped', reason: 'subagent_context' });
return;
}
try {
await this.summarizeSession(req, res, parsed.data, teamId, projectId);
} catch (error) {
logger.error('SYSTEM', 'compat summarize adapter failed', {
error: error instanceof Error ? error.message : String(error),
contentSessionId: parsed.data.contentSessionId,
});
res.status(500).json({ status: 'error', reason: 'internal_error' });
}
}));
}
private async summarizeSession(
req: Request,
res: Response,
data: z.infer<typeof summarizeSchema>,
teamId: string,
projectId: string,
): Promise<void> {
const platformSource = normalizePlatformSource(
typeof data.platformSource === 'string'
? data.platformSource
: DEFAULT_PLATFORM_SOURCE,
);
const session = await resolveServerSession({
pool: this.options.pool,View on GitHub (pinned to d8bc9755e7)