{"record":{"id":"2559c37515144feb","repo":"saadeghi/daisyui","slug":"flag-requires-a-value","errorCode":null,"errorMessage":"${flag} requires a value","messagePattern":"(.+?) requires a value","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/tailwind-play-share/index.mjs","lineNumber":36,"sourceCode":"\nOptions:\n  --html <code>       HTML source\n  --css <code>        CSS source\n  --html-file <path>  Read HTML from a file\n  --css-file <path>   Read CSS from a file\n  --browser <path>    Chrome/Chromium executable\n  --timeout <ms>      Timeout for each browser operation (default: ${DEFAULT_TIMEOUT_MS})\n  --headed            Show the browser window\n  --verbose           Write progress information to stderr\n  --help              Show this help\n\nThe created Tailwind Play URL is the only value written to stdout.\nSet TAILWIND_PLAY_BROWSER or CHROME_PATH to configure the browser without a flag.`\n\nfunction takeValue(argv, index, flag) {\n  const value = argv[index + 1]\n  if (value === undefined) {\n    throw new Error(`${flag} requires a value`)\n  }\n  return value\n}\n\nfunction parseArgs(argv) {\n  const options = {\n    browser: undefined,\n    css: undefined,\n    cssFile: undefined,\n    headed: false,\n    help: false,\n    html: undefined,\n    htmlFile: undefined,\n    timeoutMs: DEFAULT_TIMEOUT_MS,\n    verbose: false,\n  }\n  const positional = []\n","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/saadeghi/daisyui/blob/42b09e637e09467aa54a813a5aea53c1179aec75/packages/tailwind-play-share/index.mjs#L18-L54","documentation":"takeValue reads argv[index+1] for value-taking flags (--html, --css, --html-file, --css-file, --browser, --timeout). It throws when that next token is undefined, i.e. the flag was the last token on the command line with no value after it.","triggerScenarios":"A value flag placed at the end of the command line; a flag whose value was consumed/dropped by shell quoting; a flag followed by another flag instead of a value.","commonSituations":"Shell removed an empty quoted value; copy-paste left `--html` with nothing after it; user assumed the flag was boolean.","solutions":["Provide the value immediately after the flag.","Quote the value so the shell does not drop it.","Confirm the flag is not the last token."],"exampleFix":"# before\nbun .../index.mjs --html\n# after\nbun .../index.mjs --html '<div>hi</div>'","handlingStrategy":"validation","validationCode":"// Before calling, ensure every value flag has a following non-flag token.\nfunction ensureValuesProvided(argv, valueFlags) {\n  for (let i = 0; i < argv.length; i += 1) {\n    if (valueFlags.includes(argv[i]) && argv[i + 1] === undefined) {\n      throw new Error(`${argv[i]} requires a value`)\n    }\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always quote flag values in the shell.","Never place a value-taking flag at the very end of the command line.","When scripting, build argv with explicit value pairs."],"tags":["cli","argument","parsing"],"backgroundTag":null,"analyzedSha":"42b09e637e09467aa54a813a5aea53c1179aec75","analyzedAt":"2026-08-13T04:10:09.555Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}