{"record":{"id":"0f0a8c81bdf7c40f","repo":"deepseek-ai/deepseek-harness","slug":"seed-event-at-index-index-is-not-losslessly-jso","errorCode":null,"errorMessage":"seed event at index ${index} is not losslessly JSON-serializable","messagePattern":"seed event at index (.+?) is not losslessly JSON-serializable","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/session/src/index.ts","lineNumber":521,"sourceCode":"    mode: 'snapshot' | 'restore' = 'snapshot',\n  ) {\n    const restoredHeader = mode === 'restore'\n      ? validateRestoredSessionHeader(id, header)\n      : undefined\n    if (seed !== undefined) {\n      // Validate the seed to the SAME invariants `append` enforces, so a\n      // replay/fork (`ctx.sessions.create(id, { seed })`) cannot construct a\n      // live log that no persistence backend could store: each event's `data`\n      // must be JSON-serializable, and `seq` must be contiguous from 0 (the\n      // `seq = log.length` contract the whole system relies on). Without this,\n      // a bad seed would surface only later as a backend rejection or a silent\n      // divergence between the live log and disk.\n      for (const [index, source] of seed.entries()) {\n        // The seed is a persistence/replay boundary: validate and detach the\n        // complete event in one lossless-JSON pass.\n        const snapshot = mode === 'restore' ? source : snapshotJsonValue(source)\n        if (snapshot === undefined) {\n          throw new Error(`seed event at index ${index} is not losslessly JSON-serializable`)\n        }\n        assertSessionEventEnvelope(snapshot, index)\n        assertSupportedRequestHeader(snapshot.type, snapshot.data, `seed event at index ${index}`)\n        if (snapshot.seq !== index) {\n          throw new Error(`seed event at index ${index} has seq ${snapshot.seq} (expected ${index}); seed must be contiguous from 0`)\n        }\n        // A seed is accepted incrementally through the same transition as a\n        // live append and a full-log fold. The candidate is planned before it\n        // enters `log`, so a failure cannot partially mutate the surface.\n        try {\n          this.surfaceManager.validateNext(snapshot)\n        } catch (error: unknown) {\n          throw new Error(`invalid seed event at index ${index}: ${error instanceof Error ? error.message : 'invalid surface metadata'}`)\n        }\n        this.log.push(mode === 'restore' ? freezeRestoredObject(snapshot) : deepFreeze(snapshot))\n      }\n    }\n    this.firstLiveSeq = this.log.length","sourceCodeStart":503,"sourceCodeEnd":539,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/core/session/src/index.ts#L503-L539","documentation":"Error \"seed event at index ${index} is not losslessly JSON-serializable\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/core/session/src/index.ts:521 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the seed event is losslessly JSON-serializable."],"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"}