{"record":{"id":"71c1ec3a9e86950f","repo":"deepseek-ai/deepseek-harness","slug":"session-header-is-not-losslessly-json-serializable","errorCode":null,"errorMessage":"session header is not losslessly JSON-serializable","messagePattern":"session header is not losslessly JSON-serializable","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/session/src/index.ts","lineNumber":155,"sourceCode":"\n/** Validate and freeze one exclusively owned persistence header in place. */\nfunction validateRestoredSessionHeader(id: SessionId, input: unknown): SessionHeader {\n  if (input !== null && typeof input === 'object' && !Array.isArray(input)) {\n    const prototype = Reflect.getPrototypeOf(input)\n    if (prototype !== Object.prototype && prototype !== null) {\n      throw new Error('session header is not a plain JSON record')\n    }\n  }\n  return validateSessionHeader(id, input)\n}\n\n/** Detach, validate, and freeze the creation metadata published by a session. */\nfunction snapshotSessionHeader(id: SessionId, source?: SessionHeader): SessionHeader {\n  const input: unknown = source === undefined\n    ? { version: SESSION_FORMAT_VERSION, id, createdAt: Date.now() }\n    : source\n  const snapshot = snapshotJsonValue(input)\n  if (snapshot === undefined) throw new Error('session header is not losslessly JSON-serializable')\n  return validateSessionHeader(id, snapshot)\n}\n\n/**\n * Validate an exclusively owned event and deeply freeze its identified message\n * without copying the event. The caller transfers an object graph that no\n * producer retains and that shares no mutable children with another event.\n * Use {@link snapshotSessionEvent} when exclusive ownership is not guaranteed.\n * @param event - exclusively owned event imported across a trusted boundary.\n * @returns the same event object with a validated, deeply frozen message.\n */\nexport function adoptSessionEvent<T extends SessionEvent>(event: T): T {\n  assertMessageEventShape(\n    event,\n    `session event at seq ${event.seq}`,\n  )\n  switch (event.type) {\n    case 'user/message':","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/core/session/src/index.ts#L137-L173","documentation":"Error \"session header is not losslessly JSON-serializable\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/core/session/src/index.ts:155 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the session header round-trips JSON losslessly."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b150a551b8d465e31e418e1b2eaf5e79bbb7d28e","analyzedAt":"2026-08-24T18:12:29.105Z","schemaVersion":2},"datasetVersion":"2026-08-24T22:17:12.610Z"}