saadeghi/daisyui · error · Error
Unknown option: ${argument}
Error message
Unknown option: ${argument} What it means
Thrown by the default branch of the option-parsing switch in parsePreviewArgs when an argument starts with an unrecognized flag. Unlike index.mjs, pr-preview.mjs treats any unrecognized token as an error rather than a positional.
Source
Thrown at packages/tailwind-play-share/pr-preview.mjs:84
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 options
}
function git(args) {
try {
return execFileSync("git", args, {
cwd: repositoryRoot,
encoding: "utf8",
maxBuffer: 32 * 1024 * 1024,
stdio: ["ignore", "pipe", "pipe"],
})
} catch (error) {
const details = error.stderr?.trim() || error.message
throw new Error(`git ${args[0]} failed: ${details}`)
}View on GitHub (pinned to 42b09e637e)
Solutions
- Run `--help` to list the accepted flags for pr-preview.mjs.
- Remove or correct the unknown flag.
- Use index.mjs (not pr-preview.mjs) for HTML/CSS input flags.
Example fix
// before bun packages/tailwind-play-share/pr-preview.mjs --html '<div/>' --base-sha a --head-sha b --output o.json // after bun packages/tailwind-play-share/index.mjs --html '<div/>' --css ''
Defensive patterns
Strategy: validation
Validate before calling
const KNOWN_FLAGS = new Set(["--base-sha", "--head-sha", "--output", "--browser", "--timeout", "--verbose", "--help", "-h"])
function onlyKnownFlags(argv) {
for (const a of argv) if (a.startsWith("-") && !KNOWN_FLAGS.has(a)) throw new Error(`Unknown option: ${a}`)
} Try / catch
try {
options = parsePreviewArgs(argv)
} catch (error) {
if (error.message.startsWith("Unknown option:")) {
// show --help and correct the flag
}
throw error
} Prevention
- Run --help to confirm accepted flags before scripting the invocation.
- Use index.mjs for HTML/CSS input; pr-preview.mjs only takes preview flags.
- Validate flags against a known set in CI wrappers.
When it happens
Trigger: Passing a flag the parser does not know (e.g. --html, --css, --headed, --sha, -v) to pr-preview.mjs.
Common situations: Confusing pr-preview.mjs options with index.mjs options, a typo in a flag name, or passing --help-style flags that do not exist for this entry point.
Related errors
- ${flag} requires a value
- --timeout must be a positive number of milliseconds
- A daisyUI source file is required
- Unsupported daisyUI source file: ${sourceFile}
- ${flag} requires a value
AI-assisted analysis of saadeghi/daisyui@42b09e637e (2026-08-13).
Data as JSON: /api/errors/0e7d0afdf97d8a94.
Report an issue: GitHub.