{"record":{"id":"be4d5e0c0a869b24","repo":"oven-sh/bun","slug":"invalid-boolean-value-v","errorCode":null,"errorMessage":"Invalid boolean value: ${v}","messagePattern":"Invalid boolean value: (.+?)","errorType":"exception","errorClass":"BuildError","httpStatus":null,"severity":"error","filePath":"scripts/build.ts","lineNumber":575,"sourceCode":"    } else if (boolFields.has(key)) {\n      (overrides as Record<string, boolean>)[key] = parseBool(value);\n    } else if (stringFields.has(key)) {\n      (overrides as Record<string, string>)[key] = value;\n    } else {\n      throw new BuildError(`Unknown config field: --${rawKey}`, {\n        hint: `Known fields: profile, target, ${[...boolFields, ...stringFields].sort().join(\", \")}`,\n      });\n    }\n  }\n\n  return { profile, overrides, ninjaTargets, ninjaArgs, execArgs, configureOnly, quiet, configFile };\n}\n\nfunction parseBool(v: string): boolean {\n  const lower = v.toLowerCase();\n  if ([\"on\", \"true\", \"yes\", \"1\"].includes(lower)) return true;\n  if ([\"off\", \"false\", \"no\", \"0\"].includes(lower)) return false;\n  throw new BuildError(`Invalid boolean value: ${v}`, { hint: \"Use on/off, true/false, yes/no, or 1/0\" });\n}\n\nconst USAGE = `\\\nUsage: bun scripts/build.ts [options] [exec-args...]\n\nOptions:\n  --profile=<name>        Build profile (default: debug)\n                          Profiles: debug, debug-local, debug-no-asan,\n                                    release, release-local, release-asan,\n                                    release-assertions, ci-*,\n                                    windows-{x64,arm64}[-release] (cross-compile\n                                    from a non-Windows host)\n  --<field>=<value>       Override a config field. Boolean fields take\n                          on/off/true/false/yes/no/1/0.\n                          Fields: asan, lto, assertions, logs, baseline,\n                                  canary, valgrind, webkit (prebuilt|local),\n                                  local-deps (name=path[,name=path] — build a\n                                  vendored dep from a local checkout),","sourceCodeStart":557,"sourceCodeEnd":593,"githubUrl":"https://github.com/oven-sh/bun/blob/8c5296ac459e8252d3cd702f3fbcbb0c249d95d5/scripts/build.ts#L557-L593","documentation":"parseBool() in scripts/build.ts converts --flag=value strings into booleans for the config's bool fields. It accepts on/true/yes/1 and off/false/no/0 case-insensitively; any other token throws this BuildError, with the accepted spellings restated in the hint.","triggerScenarios":"--asan=maybe, --verbose=ENABLE, --ci=2, or an empty value (--ci=) — none are in the accepted literal lists.","commonSituations":"Copy-pasting CMake-style values that do not translate; values interpolated from environment variables that turn out empty or unexpected; quoting mishaps in CI YAML.","solutions":["Use one of the listed literals: on/off, true/false, yes/no, or 1/0 (case-insensitive)","If the value comes from a variable, echo it first to catch empty content","Re-read the hint text — it restates the accepted set verbatim"],"exampleFix":"# before\n$ bun bd --asan=maybe\nBuildError: Invalid boolean value: maybe\n\n# after\n$ bun bd --asan=off","handlingStrategy":"validation","validationCode":"const BOOL_LITERALS = [\"on\", \"true\", \"yes\", \"1\", \"off\", \"false\", \"no\", \"0\"];\nconst v = process.argv.find(a => a.startsWith(\"--ci=\"))?.slice(5);\nif (v !== undefined && !BOOL_LITERALS.includes(v.toLowerCase())) {\n  console.error(`--ci=${v} is not boolean; use ${BOOL_LITERALS.join(\"/\")}`);\n  process.exit(2);\n}","typeGuard":"const isBoolLiteral = (v: string) =>\n  [\"on\", \"true\", \"yes\", \"1\", \"off\", \"false\", \"no\", \"0\"].includes(v.toLowerCase());","tryCatchPattern":null,"preventionTips":["Lowercase and validate env-derived values before passing them as flag operands","Standardize on true/false in scripts so on/yes variants do not drift in"],"tags":["build","cli","usage","validation","arguments"],"backgroundTag":null,"analyzedSha":"8c5296ac459e8252d3cd702f3fbcbb0c249d95d5","analyzedAt":"2026-08-16T08:01:58.794Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}