{"record":{"id":"d510bb042dae441e","repo":"deepseek-ai/deepseek-harness","slug":"tool-result-surface-replacement-may-change-only-co","errorCode":null,"errorMessage":"tool/result surface replacement may change only content","messagePattern":"tool/result surface replacement may change only content","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/session/src/surface.ts","lineNumber":315,"sourceCode":"  for (const originalSeq of shadowedSeqs) {\n    const original = events[originalSeq - baseSeq]\n    if (original?.type !== 'tool/result') {\n      throw new Error('tool/result surface replacement must target a current tool/result')\n    }\n    const originalRest = { ...original.data } as Record<string, unknown>\n    const replacementRest = { ...event.data } as Record<string, unknown>\n    const originalResult = original.data.message.content[0]\n    const replacementResult = event.data.message.content[0]\n    originalRest['message'] = {\n      ...original.data.message,\n      content: [{ ...originalResult, content: null }],\n    }\n    replacementRest['message'] = {\n      ...event.data.message,\n      content: [{ ...replacementResult, content: null }],\n    }\n    if (!isDeepEqualJson(originalRest, replacementRest)) {\n      throw new Error('tool/result surface replacement may change only content')\n    }\n  }\n}\n\n/** Validate one event at its replay boundary and prepare its atomic fold transition. */\nfunction planSurfaceEvent(\n  state: SurfaceFoldState,\n  event: SessionEvent,\n  expectedSeq: number,\n  events: readonly SessionEvent[],\n  baseSeq: number,\n): SurfacePlan | undefined {\n  if (event.seq !== expectedSeq) {\n    throw new Error(`session event seq ${event.seq} is not contiguous; expected ${expectedSeq}`)\n  }\n  const surfaceOp = surfaceOpOf(event)\n  if (surfaceOp === undefined) return\n  if (surfaceOp === 'append') {","sourceCodeStart":297,"sourceCodeEnd":333,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/core/session/src/surface.ts#L297-L333","documentation":"Error \"tool/result surface replacement may change only content\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/core/session/src/surface.ts:315 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"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"}