slidevjs/slidev · error · Error

Timesplit end ${end} is before start ${ts}

Error message

Timesplit end ${end} is before start ${ts}

What it means

parseTimesplits walks each slide's timesplit value and tracks a running end timestamp. If an absolute (non-relative) timesplit resolves to a value less than the current running total, time would move backwards, so it throws.

Source

Thrown at packages/parser/src/timesplit/timesplit.ts:34

export function parseTimesplits(inputs: TimesplitInput[]): TimesplitOutput[] {
  let ts = 0
  const outputs: TimesplitOutput[] = []
  let current: TimesplitOutput = {
    timestampStart: ts,
    timestampEnd: ts,
    noStart: 0,
    noEnd: 0,
    title: '[start]',
  }
  outputs.push(current)
  for (const input of inputs) {
    const time = parseTimeString(input.timesplit)
    const end = time.relative
      ? ts + time.seconds
      : time.seconds
    if (end < ts) {
      throw new Error(`Timesplit end ${end} is before start ${ts}`)
    }
    current.timestampEnd = end
    current.noEnd = input.no
    if (input.title) {
      current.title = input.title
    }
    ts = end
    current = {
      timestampStart: end,
      timestampEnd: end,
      noStart: input.no,
      noEnd: input.no,
    }
    outputs.push(current)
  }
  return outputs
}

View on GitHub (pinned to 0d798ace58)

Solutions

  1. Use relative offsets (+30s, +1m) so values are added to the running total
  2. Ensure absolute timestamps are strictly monotonically increasing
  3. Recompute all timesplits after reordering slides

Example fix

// before
slide 2: timesplit: 1:00
slide 3: timesplit: 0:30
// after
slide 3: timesplit: 1:30
Defensive patterns

Strategy: validation

Validate before calling

let running = 0
for (const input of inputs) {
  const t = parseTimeString(input.timesplit)
  const end = t.relative ? running + t.seconds : t.seconds
  if (end < running) throw new Error(`Non-monotonic timesplit at slide ${input.no}`)
  running = end
}

Prevention

When it happens

Trigger: Slide N has an absolute timesplit earlier than slide N-1's end, e.g. slide 2 ends at 1:00 and slide 3 declares timesplit: 0:30.

Common situations: Mixing absolute timestamps with relative (+...) offsets incorrectly; reordering slides without updating timesplits; off-by-one when computing offsets.

Related errors


AI-assisted analysis of slidevjs/slidev@0d798ace58 (2026-08-12). Data as JSON: /api/errors/1716e5f9d332e787. Report an issue: GitHub.