thedotmack/claude-mem · error · Error
canonical content: ${message}
Error message
canonical content: ${message} What it means
Error "canonical content: ${message}" thrown in thedotmack/claude-mem.
Source
Thrown at workers/sync-hub/src/canonical-content.ts:59
const ENVELOPE_KEYS = [
"body_schema_version",
"deleted",
"deleted_at",
"entity_rev",
"id",
"kind",
"mutation",
"origin_device_id",
"origin_local_id",
"payload",
"payload_schema_version",
"payload_sha256",
] as const;
const encoder = new TextEncoder();
function invalid(message: string): never {
throw new Error(`canonical content: ${message}`);
}
/** RFC-8259 JSON with recursively sorted object keys and preserved array order. */
export function canonicalJson(value: unknown): string {
return JSON.stringify(normalizeJson(value, new Set()));
}
function normalizeJson(value: unknown, seen: Set<object>): unknown {
if (value === null || typeof value === "string" || typeof value === "boolean") return value;
if (typeof value === "number") {
if (!Number.isFinite(value)) invalid("numbers must be finite");
if (!Number.isSafeInteger(value) && Number.isInteger(value)) {
invalid("integers must be safe; use decimal strings for uint64 values");
}
if (Object.is(value, -0)) return 0;
return value;
}
if (typeof value !== "object") invalid(`unsupported JSON value ${typeof value}`);View on GitHub (pinned to d768ba3643)
Solutions
- Fix the operation payload so it satisfies canonical-content rules (required fields present, correct types, valid sha256); the message names the specific violation.
- If the validator is wrong, update canonical-content.ts and its tests together.
When it happens
Trigger: Fires in the sync hub when canonicalizing entity content fails: non-object payloads, missing required fields, or values that cannot be serialized into canonical form. Guard at workers/sync-hub/src/canonical-content.ts:59 rejects malformed operations before they are sequenced, so bad content never enters the canonical log.
Common situations: See trigger scenarios.
AI-assisted analysis of thedotmack/claude-mem@d768ba3643 (2026-08-12).
Data as JSON: /api/errors/28a5390ddd6c92da.
Report an issue: GitHub.