slidevjs/slidev · error · TypeError
Invalid timestamp value: ${match[1]}
Error message
Invalid timestamp value: ${match[1]} What it means
Inside the unit-based parser, the regex ([\d.]+)([a-z]+) captured a value segment that Number() returned NaN for. In practice this is hard to hit because the regex requires digits/dots, but values like '.' (dot only) or unusual unicode digits can trigger it.
Source
Thrown at packages/parser/src/timesplit/timestring.ts:90
hrs: 3600,
hour: 3600,
hours: 3600,
day: 86400,
days: 86400,
week: 604800,
weeks: 604800,
month: 2629746,
months: 2629746,
year: 31556952,
years: 31556952,
}
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
- Always supply at least one digit before the unit (5s not .s)
- Avoid stray dots in the numeric portion
- Use plain seconds (e.g. 5) for simple values
Example fix
// before timesplit: .s // after timesplit: 1s
Defensive patterns
Strategy: validation
Validate before calling
function validUnitValues(ts: string): boolean {
return Array.from(ts.matchAll(/([\d.]+)([a-z]+)/gi)).every(m => Number.isFinite(Number(m[1])))
} Prevention
- Always prefix units with at least one digit
- Avoid stray dots in the numeric part of a unit value
When it happens
Trigger: A unit-string segment whose numeric prefix is non-parseable, e.g. '.s' (no digits) or '..5s'.
Common situations: Hand-typed timestamps missing the leading digit, double dots, or unicode digit lookalikes.
Related errors
- Invalid timestamp format
- Invalid timestamp unit: ${unit}
- Unknown timestamp remaining: ${remaining}
- Timesplit end ${end} is before start ${ts}
- Invalid aspect ratio "${str}"
AI-assisted analysis of slidevjs/slidev@0d798ace58 (2026-08-12).
Data as JSON: /api/errors/eb6db2f51abe5856.
Report an issue: GitHub.