saadeghi/daisyui · error · Error
--timeout must be a positive number of milliseconds
Error message
--timeout must be a positive number of milliseconds
What it means
Thrown while parsing --timeout in pr-preview.mjs when the supplied string is not a finite positive number (Number(value) is NaN/Infinity or <= 0). The value must be a positive integer number of milliseconds.
Source
Thrown at packages/tailwind-play-share/pr-preview.mjs:70
options.baseSha = takeValue(argv, index, argument)
index += 1
break
case "--head-sha":
options.headSha = takeValue(argv, index, argument)
index += 1
break
case "--output":
options.output = takeValue(argv, index, argument)
index += 1
break
case "--browser":
options.browser = takeValue(argv, index, argument)
index += 1
break
case "--timeout": {
const timeoutMs = Number(takeValue(argv, index, argument))
if (!Number.isFinite(timeoutMs) || timeoutMs <= 0) {
throw new Error("--timeout must be a positive number of milliseconds")
}
options.timeoutMs = timeoutMs
index += 1
break
}
case "--verbose":
options.verbose = true
break
case "--help":
case "-h":
options.help = true
break
default:
throw new Error(`Unknown option: ${argument}`)
}
}
return optionsView on GitHub (pinned to 42b09e637e)
Solutions
- Pass a plain positive integer of milliseconds, e.g. --timeout 60000.
- Drop any unit suffix; the flag is milliseconds only.
- Omit the flag to accept the 45000ms default.
Example fix
// before --timeout 45s // after --timeout 45000
Defensive patterns
Strategy: validation
Validate before calling
function parseTimeoutMs(raw) {
const ms = Number(raw)
if (!Number.isFinite(ms) || ms <= 0) {
throw new Error(`--timeout must be a positive integer of milliseconds, got: ${raw}`)
}
return ms
} Type guard
const isPositiveMillis = (v) => Number.isFinite(Number(v)) && Number(v) > 0
Try / catch
try {
options = parsePreviewArgs(argv)
} catch (error) {
if (error.message.includes("--timeout must be a positive number")) {
// re-prompt/fix the timeout value
}
throw error
} Prevention
- Pass a plain positive integer of milliseconds; never include units.
- Validate the timeout string before it reaches the parser.
- Omit --timeout to use the 45000ms default.
When it happens
Trigger: takeValue returns a string like "abc", "", "-5", "0", or "Infinity"; Number() then yields a non-finite or non-positive result and the guard fires.
Common situations: Typing the unit ("--timeout 45s"), passing zero/negative, an empty interpolation, or a locale-specific decimal separator.
Understand the failure class
- Timeouts: ETIMEDOUT, deadlines, and hung requests — what actually expires when a request times out.
Related errors
- --timeout must be a positive number of milliseconds
- Provide HTML/CSS using arguments, files, or JSON on stdin
- html must be a string
- css must be a string
- ${flag} requires a value
AI-assisted analysis of saadeghi/daisyui@42b09e637e (2026-08-13).
Data as JSON: /api/errors/9c5c9716f5d06f3b.
Report an issue: GitHub.