{"record":{"id":"cd4a6ed248b6f130","repo":"deepseek-ai/deepseek-harness","slug":"session-event-event-type-carries-an-invalid-r","errorCode":null,"errorMessage":"session event \"${event.type}\" carries an invalid replace surfaceOp","messagePattern":"session event \"(.+?)\" carries an invalid replace surfaceOp","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/session/src/surface.ts","lineNumber":205,"sourceCode":"  if (!isSurfaceEligibleType(event.type)) {\n    if (raw.surfaceOp !== undefined) {\n      throw new Error(`session event \"${event.type}\" is not surface-eligible and cannot carry surfaceOp`)\n    }\n    if (raw.sourceEventSeqs !== undefined) {\n      throw new Error(`session event \"${event.type}\" is not surface-eligible and cannot carry sourceEventSeqs`)\n    }\n    return\n  }\n  const op = raw.surfaceOp\n  if (op === undefined) {\n    throw new Error(`session event \"${event.type}\" is surface-eligible and requires a surfaceOp marker`)\n  }\n  if (op === 'append') return op\n  if (op === null || typeof op !== 'object' || Array.isArray(op)) {\n    throw new Error(`session event \"${event.type}\" carries an invalid surfaceOp`)\n  }\n  if (!isReplaceOp(op)) {\n    throw new Error(`session event \"${event.type}\" carries an invalid replace surfaceOp`)\n  }\n  return op\n}\n\n/** Validate cited source-event seqs against prior log entries and the replacement range. */\nfunction assertProvenance(\n  event: SessionEvent,\n  shadowedSeqs: readonly number[],\n): void {\n  const raw = (event as SessionEvent & { sourceEventSeqs?: unknown }).sourceEventSeqs\n  const sources = new Set<number>()\n  if (raw !== undefined) {\n    if (!Array.isArray(raw)) {\n      throw new Error(`sourceEventSeqs on event at seq ${event.seq} must be an array when present`)\n    }\n    if (raw.length === 0 && event.type !== 'assistant/message') {\n      throw new Error('sourceEventSeqs must not be empty except on assistant/message')\n    }","sourceCodeStart":187,"sourceCodeEnd":223,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/core/session/src/surface.ts#L187-L223","documentation":"Error \"session event \"${event.type}\" carries an invalid replace surfaceOp\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/core/session/src/surface.ts:205 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"}