{"record":{"id":"a9729df40a70d713","repo":"oven-sh/bun","slug":"rawkey-requires-a-value","errorCode":null,"errorMessage":"--${rawKey} requires a value","messagePattern":"--(.+?) requires a value","errorType":"exception","errorClass":"BuildError","httpStatus":null,"severity":"error","filePath":"scripts/build.ts","lineNumber":542,"sourceCode":"      continue;\n    }\n    const rawKey = eq[1]!;\n    const key = rawKey.replace(/-([a-z])/g, (_, c: string) => c.toUpperCase());\n    const isOurs =\n      key === \"profile\" || key === \"target\" || key === \"configFile\" || boolFields.has(key) || stringFields.has(key);\n\n    let value = eq[2];\n    if (value === undefined) {\n      // No `=`. If this is one of our flags, consume next arg as value.\n      // If not (e.g. --print, --watch), it's a bun-debug flag → exec args.\n      if (!isOurs) {\n        execArgs.push(arg);\n        inExec = true;\n        continue;\n      }\n      value = argv[++i];\n      if (value === undefined) {\n        throw new BuildError(`--${rawKey} requires a value`);\n      }\n    }\n\n    if (key === \"target\") {\n      ninjaTargets.push(value);\n      continue;\n    }\n    if (key === \"configFile\") {\n      configFile = value;\n      configureOnly = true;\n      continue;\n    }\n    if (key === \"profile\") {\n      profile = value;\n    } 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;","sourceCodeStart":524,"sourceCodeEnd":560,"githubUrl":"https://github.com/oven-sh/bun/blob/8c5296ac459e8252d3cd702f3fbcbb0c249d95d5/scripts/build.ts#L524-L560","documentation":"In scripts/build.ts arg parsing, a recognized flag was given without `=`, so the parser consumes the next argv entry as its value — but argv ended first. The error names the flag via rawKey so you know which operand is missing.","triggerScenarios":"bun bd --profile with nothing after it; bun scripts/build.ts --config-file as the last token; a shell line whose value token was lost to quoting or line-wrapping.","commonSituations":"Truncated copy-pasted commands; line continuations eating the value; typos where the value was placed before the flag.","solutions":["Supply the value: --profile=release (or `--profile release`)","Check nothing after the flag was swallowed by quoting or line-continuation","Consult the USAGE block for the flag's expected value"],"exampleFix":"# before\n$ bun bd --profile\nBuildError: --profile requires a value\n\n# after\n$ bun bd --profile=release","handlingStrategy":"validation","validationCode":"const NEEDS_VALUE = new Set([\"profile\", \"configFile\" /*, ...boolFields, ...stringFields */]);\nfor (let i = 2; i < process.argv.length; i++) {\n  const a = process.argv[i];\n  if (a.startsWith(\"--\") && !a.includes(\"=\") && NEEDS_VALUE.has(a.slice(2)) && i + 1 >= process.argv.length) {\n    console.error(`${a} requires a value`);\n    process.exit(2);\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Prefer the --key=value form — it cannot be split by line breaks or missing tokens","Review full commands after copy-pasting from docs"],"tags":["build","cli","usage","arguments"],"backgroundTag":null,"analyzedSha":"8c5296ac459e8252d3cd702f3fbcbb0c249d95d5","analyzedAt":"2026-08-16T08:01:58.794Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}