{"record":{"id":"0ba451fb5395af49","repo":"affaan-m/ECC","slug":"missing-value-for-option","errorCode":null,"errorMessage":"Missing value for ${option}.","messagePattern":"Missing value for (.+?)\\.","errorType":"exception","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/01e15490f04e29cfefe3896951f43db46994d8ee/skills/terminal-opener/scripts/open-terminal.js#L65-L101","documentation":"readValue reads the token immediately after --terminal or --cwd. If that next token is undefined (the option was last in argv) or itself starts with '--' (looks like another flag), the value is considered missing and rejected. This prevents silently consuming a following flag as a path or terminal name.","triggerScenarios":"--terminal or --cwd is the last token (no value follows), or the token after it begins with '--' (e.g. '--cwd --launch'). readValue is called from parseArgs for those two options.","commonSituations":"Typo or truncated command line; forgetting to supply the value; a flag accidentally placed where the value should go; scripting that joins flags incorrectly.","solutions":["Supply a concrete value immediately after --terminal or --cwd.","Make sure the value does not itself start with '--'; if a path legitimately starts with '--', pass it via env (ECC_TERMINAL) or restructure.","Check the command line for a missing or misplaced token."],"exampleFix":"# before\nnode open-terminal.js --cwd --launch -- echo hi\n\n# after\nnode open-terminal.js --cwd /tmp --launch -- echo hi","handlingStrategy":"validation","validationCode":"function readOptionValue(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}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always supply a concrete value immediately after --terminal or --cwd.","In scripts, validate that the expected value token exists before invoking."],"tags":["validation","argument-parsing","terminal"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}