{"record":{"id":"829e4e9bb27e75e2","repo":"stablyai/orca","slug":"missing-value-for-flag","errorCode":null,"errorMessage":"Missing value for ${flag}","messagePattern":"Missing value for (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"config/scripts/rebuild-native-deps.mjs","lineNumber":377,"sourceCode":"      continue\n    }\n    if (arg === '--arch') {\n      options.arch = readRequiredArgValue(args, (index += 1), '--arch')\n      continue\n    }\n    if (arg.startsWith('--arch=')) {\n      options.arch = readInlineArgValue(arg, '--arch')\n      continue\n    }\n    throw new Error(`Unknown argument: ${arg}`)\n  }\n  return options\n}\n\nfunction readRequiredArgValue(args, index, flag) {\n  const value = args[index]\n  if (!value || value.startsWith('--')) {\n    throw new Error(`Missing value for ${flag}`)\n  }\n  return value\n}\n\nfunction readInlineArgValue(arg, flag) {\n  const value = arg.slice(`${flag}=`.length)\n  if (!value) {\n    throw new Error(`Missing value for ${flag}`)\n  }\n  return value\n}\n\nfunction getElectronExecutablePath() {\n  const platformPath = getElectronPlatformPath()\n  return process.env.ELECTRON_OVERRIDE_DIST_PATH\n    ? resolve(process.env.ELECTRON_OVERRIDE_DIST_PATH, platformPath)\n    : resolve(electronPackageDir, 'dist', platformPath)\n}","sourceCodeStart":359,"sourceCodeEnd":395,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/config/scripts/rebuild-native-deps.mjs#L359-L395","documentation":"Thrown by readRequiredArgValue in config/scripts/rebuild-native-deps.mjs when a flag that expects a separate value (--platform or --arch) is followed by nothing, or by a token that itself starts with `--`. The parser reads the next argv slot as the value; if that slot is missing or looks like another flag, it refuses rather than silently consuming the wrong token.","triggerScenarios":"Run `... --platform` as the last argument, or `... --platform --arch x64` (the value slot is occupied by another flag). readRequiredArgValue at lines 374-379 sees `value` falsy or starting with `--` and throws at line 376-377.","commonSituations":"A copy-pasted command drops the value, a shell-quoting bug eats the argument, or a user expects `--platform` to default. Putting the value on the next line in a multi-line shell command that loses the continuation is another common source.","solutions":["Provide the value on the next slot: `--platform win32`, not bare `--platform`.","Prefer the inline form `--platform=win32` to avoid next-slot ambiguity.","Check the command for a lost line-continuation (trailing backslash) before the value."],"exampleFix":"// before\nnode config/scripts/rebuild-native-deps.mjs --platform\n\n// after\nnode config/scripts/rebuild-native-deps.mjs --platform win32\n# or\nnode config/scripts/rebuild-native-deps.mjs --platform=win32","handlingStrategy":"validation","validationCode":"// Before invoking, ensure every space-separated value-flag has a value\nfor (let i = 0; i < args.length; i++) {\n  if ((args[i] === '--platform' || args[i] === '--arch') && (!args[i + 1] || args[i + 1].startsWith('--'))) {\n    throw new Error(`Missing value for ${args[i]}`)\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Provide the value immediately after --platform/--arch.","Prefer the inline `--platform=value` form to avoid next-slot ambiguity.","Check multi-line shell commands for a lost trailing backslash before the value."],"tags":["cli","args","config","build","validation"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}