{"record":{"id":"c05995fe99c8db00","repo":"oven-sh/bun","slug":"unknown-config-field-rawkey","errorCode":null,"errorMessage":"Unknown config field: --${rawKey}","messagePattern":"Unknown config field: --(.+?)","errorType":"exception","errorClass":"BuildError","httpStatus":null,"severity":"error","filePath":"scripts/build.ts","lineNumber":562,"sourceCode":"    }\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;\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","sourceCodeStart":544,"sourceCodeEnd":580,"githubUrl":"https://github.com/oven-sh/bun/blob/8c5296ac459e8252d3cd702f3fbcbb0c249d95d5/scripts/build.ts#L544-L580","documentation":"scripts/build.ts maps --key=value pairs onto a PartialConfig. After handling profile/target/configFile, remaining keys must exist in boolFields or stringFields; anything else is rejected with this BuildError, and the hint enumerates every accepted field name.","triggerScenarios":"A typo like --canary=true for a field named differently; passing a bun-debug runtime flag with an `=` (runtime flags without `=` fall through to execArgs safely); using a field name removed or renamed in this version of build.ts.","commonSituations":"Flags remembered from an older checkout; CI scripts carrying stale option names; autocomplete or muscle-memory typos.","solutions":["Read the hint — it lists the valid fields; use exactly those names","Fix the typo (e.g. --profiled -> --profile)","For flags meant for the built binary, drop the `=` form so they route to execArgs","Check USAGE (run bun scripts/build.ts with no args) for the current option set"],"exampleFix":"# before\n$ bun bd --asan=off --canary=true\nBuildError: Unknown config field: --canary\n\n# after — only real config fields; runtime flags go after the build args\n$ bun bd --asan=off","handlingStrategy":"validation","validationCode":"const known = new Set([\"profile\", \"target\", \"configFile\" /*, ...boolFields, ...stringFields */]);\nfor (const arg of process.argv.slice(2)) {\n  const m = /^--([^=]+)=/.exec(arg);\n  if (m && !known.has(m[1])) {\n    console.error(`unknown --${m[1]}; valid: ${[...known].sort().join(\", \")}`);\n    process.exit(2);\n  }\n}","typeGuard":"const isKnownConfigKey = (k: string) =>\n  k === \"profile\" || k === \"target\" || k === \"configFile\" || boolFields.has(k) || stringFields.has(k);","tryCatchPattern":null,"preventionTips":["Update shell aliases and CI scripts when build flags change between checkouts","Keep runtime flags for the binary visually separate from build flags"],"tags":["build","cli","usage","configuration"],"backgroundTag":null,"analyzedSha":"8c5296ac459e8252d3cd702f3fbcbb0c249d95d5","analyzedAt":"2026-08-16T08:01:58.794Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}