slidevjs/slidev · error · TypeError

Unknown timestamp remaining: ${remaining}

Error message

Unknown timestamp remaining: ${remaining}

What it means

After stripping every <number><unit> segment from the timestamp string, leftover characters remain. The parser expects the entire string (after trimming) to be consumed.

Source

Thrown at packages/parser/src/timesplit/timestring.ts:101

    }
    const regex = /([\d.]+)([a-z]+)/gi
    const matches = timestamp.matchAll(regex)
    if (matches) {
      for (const match of matches) {
        const value = Number(match[1])
        if (Number.isNaN(value)) {
          throw new TypeError(`Invalid timestamp value: ${match[1]}`)
        }
        const unit = match[2].toLowerCase()
        if (!(unit in unitMap)) {
          throw new TypeError(`Invalid timestamp unit: ${unit}`)
        }
        seconds += value * unitMap[unit]
      }
    }
    const remaining = timestamp.replace(regex, '').trim()
    if (remaining) {
      throw new TypeError(`Unknown timestamp remaining: ${remaining}`)
    }
  }

  return {
    seconds,
    relative,
  }
}

View on GitHub (pinned to 0d798ace58)

Solutions

  1. Remove any text that is not a <number><unit> pair
  2. Use a single separator-less form (5s3m) for compound durations
  3. Strip parenthetical notes or comments out of the timestamp

Example fix

// before
timesplit: 5s (approx)
// after
timesplit: 5s
Defensive patterns

Strategy: validation

Validate before calling

function fullyConsumed(ts: string): boolean {
  return ts.replace(/[\d.]+[a-z]+/gi, '').trim() === ''
}

Prevention

When it happens

Trigger: Strings like '5s foo', '5s,3s' (comma), or '5s (approx)' where non-matching text survives the regex pass.

Common situations: Pasting human-readable durations with annotations or separators; trailing punctuation.

Related errors


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