{"record":{"id":"0ba451fb5395af49","repo":"affaan-m/ECC","slug":"missing-value-for-option","errorCode":null,"errorMessage":"Missing value for ${option}.","messagePattern":"Missing value for (.+?)\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"skills/terminal-opener/scripts/open-terminal.js","lineNumber":83,"sourceCode":"    );\n  }\n  if (!resemblesExecutablePath && /[;&|<>`$]/.test(value)) {\n    throw new Error(\n      'Executable must be one argv entry, not an interpolated shell command string.'\n    );\n  }\n}\n\nfunction validateArgv(argv) {\n  for (const argument of argv) {\n    if (argument.includes('\\0')) throw new Error('Arguments must not contain NUL bytes.');\n  }\n}\n\nfunction readValue(argv, index, option) {\n  const value = argv[index + 1];\n  if (value === undefined || value.startsWith('--')) {\n    throw new Error(`Missing value for ${option}.`);\n  }\n  return value;\n}\n\nfunction parseArgs(argv, context = {}) {\n  const env = context.env || process.env;\n  const initialTerminal = env.ECC_TERMINAL || DEFAULT_TERMINAL;\n  const initialCwd = context.cwd || process.cwd();\n  const options = {\n    argv: [],\n    cwd: initialCwd,\n    detect: false,\n    dryRun: true,\n    executable: undefined,\n    help: false,\n    json: false,\n    mode: 'normal',\n    terminal: initialTerminal,","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/skills/terminal-opener/scripts/open-terminal.js#L65-L101","documentation":"readValue fetches the value following an option token and throws when it is missing. A value is considered missing if the next argv entry is undefined (end of input) or begins with `--` (looks like another option rather than a value). This keeps option parsing unambiguous.","triggerScenarios":"Running `open-terminal.js --cwd` with nothing after it, or `--terminal --launch` where the next token is another flag instead of the terminal name.","commonSituations":"Forgetting the value entirely (`--cwd` alone); values that legitimately start with `--` (e.g. a directory named `--data`) triggering the misparse; reordered flags leaving an option dangling at the end.","solutions":["Supply the value right after the option: `--cwd /abs/path`, `--terminal wezterm`.","If a value genuinely starts with `--`, use its absolute path or use `--cwd=\"$VALUE\"` style / restructure so it doesn't collide with option syntax.","Check flag ordering so no option is the last token on the command line."],"exampleFix":"// before\nnode open-terminal.js --terminal --launch\n// after\nnode open-terminal.js --terminal wezterm --launch","handlingStrategy":"validation","validationCode":"const argv = process.argv.slice(2);\nconst needValue = ['--terminal', '--cwd', '--executable'];\nargv.forEach((t, i) => { if (needValue.includes(t) && (argv[i+1] === undefined || argv[i+1].startsWith('--'))) throw new Error(`missing value for ${t}`); });","typeGuard":"null","tryCatchPattern":"try {\n  parseArgs(process.argv);\n} catch (e) {\n  if (/^Missing value for /.test(e.message)) {\n    console.error(e.message, '— see --help for option usage');\n  } else throw e;\n}","preventionTips":["Always place option values immediately after their flag.","Avoid values that begin with `--`; use absolute paths instead.","Check command lines for dangling flags before execution.","Use `--opt=value` style wrappers where supported to make binding explicit."],"tags":["cli","parsing","arguments"],"backgroundTag":"missing-cli-argument","analyzedSha":"8321021c54d670126ce3b2969d5deb880b4b0c2a","analyzedAt":"2026-09-16T10:08:13.343Z","contentChangedAt":"2026-09-16T10:08:13.343Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}