saadeghi/daisyui · error · Error

Use either --html or --html-file, not both

Error message

Use either --html or --html-file, not both

What it means

HTML may be supplied either inline (--html) or from a file (--html-file), but not both. After parsing, if both options are set the script throws rather than guessing precedence.

Source

Thrown at packages/tailwind-play-share/index.mjs:111

        break
      case "--help":
      case "-h":
        options.help = true
        break
      case "--":
        positional.push(...argv.slice(index + 1))
        index = argv.length
        break
      default:
        if (argument.startsWith("-")) {
          throw new Error(`Unknown option: ${argument}`)
        }
        positional.push(argument)
    }
  }

  if (options.html !== undefined && options.htmlFile !== undefined) {
    throw new Error("Use either --html or --html-file, not both")
  }
  if (options.css !== undefined && options.cssFile !== undefined) {
    throw new Error("Use either --css or --css-file, not both")
  }

  if (options.html === undefined && options.htmlFile === undefined && positional.length > 0) {
    options.html = positional.shift()
  }
  if (options.css === undefined && options.cssFile === undefined && positional.length > 0) {
    options.css = positional.shift()
  }
  if (positional.length > 0) {
    throw new Error("Too many positional arguments")
  }

  return options
}

View on GitHub (pinned to 42b09e637e)

Solutions

  1. Remove one of the two flags.
  2. Use --html-file when the content is large, --html for short inline snippets.

Example fix

# before
bun .../index.mjs --html '<div/>' --html-file page.html
# after
bun .../index.mjs --html-file page.html
Defensive patterns

Strategy: validation

Validate before calling

if (options.html !== undefined && options.htmlFile !== undefined) {
  throw new Error('Use either --html or --html-file, not both')
}

Prevention

When it happens

Trigger: Passing `--html '<code>' --html-file path.html` together in one invocation.

Common situations: Leftover flags from a previous run pasted back in; a wrapper script appends a default --html while the user also passes --html-file.

Related errors


AI-assisted analysis of saadeghi/daisyui@42b09e637e (2026-08-13). Data as JSON: /api/errors/d24cf48f218bda40. Report an issue: GitHub.