deepseek-ai/deepseek-harness · error · Error

sourceEventSeqs must not be empty except on…

Error message

sourceEventSeqs must not be empty except on assistant/message

What it means

Validation in assertProvenance: sourceEventSeqs is an empty array on an event type other than assistant/message. An empty citation list means 'replaces nothing', which is only meaningful for assistant/message; other surface events must cite at least one shadowed source event.

Solutions

  1. List the shadowed source event seqs in sourceEventSeqs
  2. Omit the field entirely instead of passing an empty array
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/core/session/src/surface.ts:222 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/f5f72b46bbb537fc. Report an issue: GitHub.

Appendix: source

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

  if (!isReplaceOp(op)) {
    throw new Error(`session event "${event.type}" carries an invalid replace surfaceOp`)
  }
  return op
}

/** Validate cited source-event seqs against prior log entries and the replacement range. */
function assertProvenance(
  event: SessionEvent,
  shadowedSeqs: readonly number[],
): void {
  const raw = (event as SessionEvent & { sourceEventSeqs?: unknown }).sourceEventSeqs
  const sources = new Set<number>()
  if (raw !== undefined) {
    if (!Array.isArray(raw)) {
      throw new Error(`sourceEventSeqs on event at seq ${event.seq} must be an array when present`)
    }
    if (raw.length === 0 && event.type !== 'assistant/message') {
      throw new Error('sourceEventSeqs must not be empty except on assistant/message')
    }
    let nonEarlierSource: number | undefined
    for (const source of raw) {
      if (!isEventSeq(source)) {
        throw new Error(`session event "${event.type}" sourceEventSeqs must densely contain non-negative safe integers`)
      }
      sources.add(source)
      if (nonEarlierSource === undefined && source >= event.seq) nonEarlierSource = source
    }
    if (sources.size !== raw.length) {
      throw new Error('sourceEventSeqs must not contain duplicates')
    }
    if (nonEarlierSource !== undefined) {
      throw new Error(`sourceEventSeqs must reference earlier events: ${nonEarlierSource} >= current seq ${event.seq}`)
    }
  }
  const missing = shadowedSeqs.filter(seq => !sources.has(seq))
  if (missing.length > 0) {

View on GitHub (pinned to b150a551b8)