saadeghi/daisyui · error · Error
Provide HTML/CSS using arguments, files, or JSON on stdin
Error message
Provide HTML/CSS using arguments, files, or JSON on stdin
What it means
If after all resolution html and css are both still undefined, there is nothing to share and the script refuses to proceed. This happens when no flags, no files, no positionals, and no usable stdin content were provided.
Source
Thrown at packages/tailwind-play-share/index.mjs:164
css = await readFile(resolve(options.cssFile), "utf8")
}
if (html === undefined && css === undefined && !process.stdin.isTTY) {
const stdin = (await readStdin()).trim()
if (stdin) {
let parsed
try {
parsed = JSON.parse(stdin)
} catch (error) {
throw new Error(`stdin must be JSON with html and css strings: ${error.message}`)
}
html = parsed.html
css = parsed.css
}
}
if (html === undefined && css === undefined) {
throw new Error("Provide HTML/CSS using arguments, files, or JSON on stdin")
}
if (html !== undefined && typeof html !== "string") {
throw new Error("html must be a string")
}
if (css !== undefined && typeof css !== "string") {
throw new Error("css must be a string")
}
return { html: html ?? "", css: css ?? "" }
}
async function isExecutable(filePath) {
try {
await access(filePath, process.platform === "win32" ? fsConstants.F_OK : fsConstants.X_OK)
return true
} catch {
return false
}View on GitHub (pinned to 42b09e637e)
Solutions
- Provide HTML or CSS via --html/--css, --html-file/--css-file, positional args, or JSON on stdin.
- If scripting non-interactively, pipe the JSON payload explicitly.
- Run with --help to see the accepted input forms.
Example fix
# before
bun .../index.mjs
# after
echo '{"html":"<div>hi</div>","css":"@import \"tailwindcss\";"}' | bun .../index.mjs Defensive patterns
Strategy: validation
Validate before calling
if (html === undefined && css === undefined) {
throw new Error('Provide HTML/CSS using arguments, files, or JSON on stdin')
} Type guard
const hasInput = (o) => o.html !== undefined || o.css !== undefined || o.htmlFile !== undefined || o.cssFile !== undefined
Prevention
- Always pass at least one HTML or CSS source.
- In non-interactive shells, pipe the JSON payload explicitly.
- Run with --help to review the accepted input forms.
When it happens
Trigger: Running the script in an interactive terminal with no arguments and no piped stdin; piping only whitespace to stdin; providing only one source via a path the script does not read.
Common situations: User runs the binary expecting a prompt; a wrapper that forgets to forward input; stdin is closed/empty in CI.
Related errors
- --timeout must be a positive number of milliseconds
- html must be a string
- css must be a string
- A daisyUI source file is required
- ${flag} requires a value
AI-assisted analysis of saadeghi/daisyui@42b09e637e (2026-08-13).
Data as JSON: /api/errors/3811287f23bee92e.
Report an issue: GitHub.