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
The --timeout value is run through Number() and must be finite and strictly greater than zero, or the script rejects it. It is interpreted as milliseconds for each browser operation.
Source
Thrown at packages/tailwind-play-share/index.mjs:82
options.css = takeValue(argv, index, argument)
index += 1
break
case "--html-file":
options.htmlFile = takeValue(argv, index, argument)
index += 1
break
case "--css-file":
options.cssFile = takeValue(argv, index, argument)
index += 1
break
case "--browser":
options.browser = takeValue(argv, index, argument)
index += 1
break
case "--timeout": {
const timeout = Number(takeValue(argv, index, argument))
if (!Number.isFinite(timeout) || timeout <= 0) {
throw new Error("--timeout must be a positive number of milliseconds")
}
options.timeoutMs = timeout
index += 1
break
}
case "--headed":
options.headed = true
break
case "--verbose":
options.verbose = true
break
case "--help":
case "-h":
options.help = true
break
case "--":
positional.push(...argv.slice(index + 1))
index = argv.lengthView on GitHub (pinned to 42b09e637e)
Solutions
- Pass a positive integer number of milliseconds (e.g. 45000).
- If you want a longer ceiling under load, raise the value rather than zeroing it.
- Drop any unit suffix; the flag expects a bare number.
Example fix
# before bun .../index.mjs --timeout 45 --html '<div/>' # after bun .../index.mjs --timeout 45000 --html '<div/>'
Defensive patterns
Strategy: validation
Validate before calling
const rawTimeout = /* the --timeout value */
const n = Number(rawTimeout)
if (!Number.isFinite(n) || n <= 0) {
throw new Error('--timeout must be a positive number of milliseconds')
}
// pass n as milliseconds Type guard
const isPositiveMillis = (v) => Number.isFinite(Number(v)) && Number(v) > 0
Prevention
- Express timeouts in milliseconds, not seconds.
- Do not use 0 to mean 'no limit'; raise the value instead.
- Drop unit suffixes like 's' or 'ms'.
When it happens
Trigger: Passing `--timeout 0`, a negative number, a non-numeric string like `abc`, an empty string, or `Infinity`/`NaN`.
Common situations: Passing the timeout in seconds (e.g. 45) instead of milliseconds (45000); passing 0 hoping to disable the timeout; trailing units like `45s`.
Understand the failure class
- Timeouts: ETIMEDOUT, deadlines, and hung requests — what actually expires when a request times out.
Related errors
- Provide HTML/CSS using arguments, files, or JSON on stdin
- --timeout must be a positive number of milliseconds
- A daisyUI source file is required
- ${flag} requires a value
- Unknown option: ${argument}
AI-assisted analysis of saadeghi/daisyui@42b09e637e (2026-08-13).
Data as JSON: /api/errors/380158a934598883.
Report an issue: GitHub.