deepseek-ai/deepseek-harness · error · SessionForkError

INVALID_BOUNDARY

INVALID_BOUNDARY

Error message

fork boundary for session "${session.id}" must be a non-negative safe integer, got ${String(boundary)}

What it means

Input validation in _forkSeed: the requested fork boundary is not a non-negative safe integer. The boundary is an inclusive source event seq; NaN, negatives, non-integers, or values beyond Number.MAX_SAFE_INTEGER cannot name an event and are rejected before any slicing.

Solutions

  1. Pass a valid event seq from the source session (0 to last event seq)
  2. Omit the boundary to fork through the source's current last event
  3. If the seq comes from external input, validate it before calling fork
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/core/session/src/index.ts:1108 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/e26ccb3808b2379a. Report an issue: GitHub.

Appendix: source

Thrown at packages/core/session/src/index.ts:1108

        ...liveSource.header.cwd !== undefined ? { cwd: liveSource.header.cwd } : {},
        parentSession: liveSource.id,
        seedLength: seed.length,
      },
    })
  }

  private _forkSeed(session: Session, requestedBoundary: number | undefined): SessionEvent[] {
    const events = session.events
    const lastEvent = events.at(-1)
    let boundary: number
    if (requestedBoundary !== undefined) {
      boundary = requestedBoundary
    } else {
      if (lastEvent === undefined) return []
      boundary = lastEvent.seq
    }
    if (!Number.isSafeInteger(boundary) || boundary < 0) {
      throw new SessionForkError(
        `fork boundary for session "${session.id}" must be a non-negative safe integer, got ${String(boundary)}`,
        'INVALID_BOUNDARY',
      )
    }
    if (boundary >= events.length) {
      const lastSeq = events.at(-1)?.seq
      throw new SessionForkError(
        `fork boundary ${boundary} does not exist in session "${session.id}" (last seq: ${lastSeq ?? 'none'})`,
        'INVALID_BOUNDARY',
      )
    }

    const boundaryEvent = events[boundary]
    if (boundaryEvent === undefined || boundaryEvent.seq !== boundary) {
      throw new SessionForkError(
        `fork boundary ${boundary} does not match a contiguous event seq in session "${session.id}"`,
        'INVALID_BOUNDARY',
      )

View on GitHub (pinned to b150a551b8)