deepseek-ai/deepseek-harness · error · Error

session event seq is not contiguous; expected

Error message

session event seq ${event.seq} is not contiguous; expected ${expectedSeq}

What it means

Contiguity check in planSurfaceEvent: the event's seq does not equal the expected next seq of the replay. Surface folding requires a dense, gapless event log; a skipped, duplicated, or out-of-order event breaks the positional fold and is rejected at the replay boundary.

Solutions

  1. Replay the full event slice from the base seq with no gaps
  2. Fix slicing logic (e.g. wrong boundary+1 offsets) that drops or duplicates events
  3. Persist and reload events in seq order
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/core/session/src/surface.ts:329 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of deepseek-ai/deepseek-harness@b150a551b8 (2026-08-24). Data as JSON: /api/errors/273a525819b6e904. Report an issue: GitHub.

Appendix: source

Thrown at packages/core/session/src/surface.ts:329

      ...event.data.message,
      content: [{ ...replacementResult, content: null }],
    }
    if (!isDeepEqualJson(originalRest, replacementRest)) {
      throw new Error('tool/result surface replacement may change only content')
    }
  }
}

/** Validate one event at its replay boundary and prepare its atomic fold transition. */
function planSurfaceEvent(
  state: SurfaceFoldState,
  event: SessionEvent,
  expectedSeq: number,
  events: readonly SessionEvent[],
  baseSeq: number,
): SurfacePlan | undefined {
  if (event.seq !== expectedSeq) {
    throw new Error(`session event seq ${event.seq} is not contiguous; expected ${expectedSeq}`)
  }
  const surfaceOp = surfaceOpOf(event)
  if (surfaceOp === undefined) return
  if (surfaceOp === 'append') {
    assertProvenance(event, [])
    return { kind: 'append', seq: event.seq }
  }
  const range = replacementRange(state, surfaceOp)
  assertProvenance(event, range.shadowedSeqs)
  assertToolResultRewrite(event, range.shadowedSeqs, events, baseSeq)
  return {
    kind: 'replace',
    seq: event.seq,
    start: surfaceOp.start,
    end: surfaceOp.end,
    ...range,
  }
}

View on GitHub (pinned to b150a551b8)