{"record":{"id":"7ac1588be86b33a9","repo":"microsoft/playwright","slug":"boolean-option-key-should-not-be-passed-wit","errorCode":null,"errorMessage":"boolean option '--${key}' should not be passed with '=value', use '--${key}' or '--no-${key}' instead","messagePattern":"boolean option '--(.+?)' should not be passed with '=value', use '--(.+?)' or '--no-(.+?)' instead","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/playwright-core/src/tools/cli-client/minimist.ts","lineNumber":76,"sourceCode":"  }\n\n  let notFlags: string[] = [];\n  const doubleDashIndex = args.indexOf('--');\n  if (doubleDashIndex !== -1) {\n    notFlags = args.slice(doubleDashIndex + 1);\n    args = args.slice(0, doubleDashIndex);\n  }\n\n  for (let i = 0; i < args.length; i++) {\n    const arg = args[i];\n    let key: string;\n    let next: string;\n\n    if ((/^--.+=/).test(arg)) {\n      const m = arg.match(/^--([^=]+)=([\\s\\S]*)$/)!;\n      key = m[1];\n      if (bools[key])\n        throw new Error(`boolean option '--${key}' should not be passed with '=value', use '--${key}' or '--no-${key}' instead`);\n      setArg(key, m[2]);\n    } else if ((/^--no-.+/).test(arg)) {\n      key = arg.match(/^--no-(.+)/)![1];\n      setArg(key, false);\n    } else if ((/^--.+/).test(arg)) {\n      key = arg.match(/^--(.+)/)![1];\n      next = args[i + 1];\n      if (\n        next !== undefined\n        && !(/^(-|--)[^-]/).test(next)\n        && !bools[key]\n      ) {\n        setArg(key, next);\n        i += 1;\n      } else if ((/^(true|false)$/).test(next)) {\n        setArg(key, next === 'true');\n        i += 1;\n      } else {","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/microsoft/playwright/blob/c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6/packages/playwright-core/src/tools/cli-client/minimist.ts#L58-L94","documentation":"Thrown by the minimist-based CLI arg parser when an argument of the form --key=value is parsed and key is registered as a boolean option. Boolean options must be passed as --key (true) or --no-key (false); attaching an =value is ambiguous and rejected.","triggerScenarios":"Running the playwright CLI (or any tool built on this minimist wrapper) with e.g. --headless=true or --no-sandbox=false where the option is declared boolean.","commonSituations":"User habitually appending =true to boolean flags; copied flags from a shell snippet that mixed boolean and string styles; CI config that normalizes all flags to --x=y form.","solutions":["Pass boolean flags bare: --headless (or its inverse --no-headless).","For string/number options, =value or a separate token both work — only booleans reject =value.","Audit your command template and convert boolean flags away from the = form."],"exampleFix":"# before\nplaywright-cli open --headless=true   # throws\n\n# after\nplaywright-cli open --headless\n# or\nplaywright-cli open --no-headless","handlingStrategy":"validation","validationCode":"function normalizeCliArgs(argv: string[], bools: Record<string, boolean>): string[] {\n  return argv.map(a => {\n    const m = a.match(/^--([^=]+)=(.+)$/);\n    if (m && bools[m[1]]) {\n      return m[2] === 'false' ? `--no-${m[1]}` : `--${m[1]}`;\n    }\n    return a;\n  });\n}","typeGuard":"function isBooleanFlagForm(arg: string, bools: Record<string, boolean>): boolean {\n  const m = arg.match(/^--([^=]+)=/);\n  return !!m && !!bools[m[1]];\n}","tryCatchPattern":"// Prefer normalizing the args before invoking the parser; try/catch is awkward here\n// because the parser runs before your code. Use the normalizeCliArgs helper above.","preventionTips":["Pass boolean flags bare (--headless) or negated (--no-headless).","When generating CLI invocations programmatically, branch on option type before emitting =value."],"tags":["cli","args-parsing","input-validation"],"backgroundTag":null,"analyzedSha":"c8fc3bf8d31542d59b4d4d9eaab1df93ff541dc6","analyzedAt":"2026-08-12T07:26:36.950Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}