saadeghi/daisyui · error · Error

Unknown option: ${argument}

Error message

Unknown option: ${argument}

What it means

During argv parsing any token starting with `-` that does not match a known case (--html, --css, --html-file, --css-file, --browser, --timeout, --headed, --verbose, --help/-h, --) falls through to the default and throws. Only bare positional tokens (no leading dash) are tolerated as unknown.

Source

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

        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.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()
  }

View on GitHub (pinned to 42b09e637e)

Solutions

  1. Run with --help to see the accepted flags.
  2. Correct the flag spelling.
  3. If a positional value starts with `-`, place it after `--`.

Example fix

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

Strategy: validation

Validate before calling

const known = new Set(['--html','--css','--html-file','--css-file','--browser','--timeout','--headed','--verbose','--help','-h','--'])
const unknown = argv.filter(a => a.startsWith('-') && !known.has(a))
if (unknown.length) throw new Error(`Unknown option: ${unknown[0]}`)

Type guard

const isKnownOption = (a) => !a.startsWith('-') || known.has(a)

Prevention

When it happens

Trigger: A misspelled flag like `--htm` or `--html-fiel`; an unsupported short flag like `-x`; a value that itself starts with `-` placed where a flag is expected.

Common situations: Typo in the flag name; copy-paste from a different tool's CLI; a negative-number positional accidentally parsed as a flag.

Related errors


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