{"record":{"id":"cade4175ec9b4cac","repo":"affaan-m/ECC","slug":"missing-value-for-install-dir","errorCode":null,"errorMessage":"Missing value for --install-dir.","messagePattern":"Missing value for --install-dir\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/nasiko.js","lineNumber":93,"sourceCode":"    throw new Error('ECC_NASIKO_CLI_EXECUTABLE must be an absolute path.');\n  }\n  return candidate;\n}\n\nfunction readStatus(options = {}) {\n  const executable = resolveExecutable(options);\n  if (!executable) return { installed: false, qualified: false, version: null, executable: null };\n  return inspectInstalledNasiko(executable);\n}\n\nfunction parseStatusArguments(argumentsList) {\n  let options = { installDir: undefined, json: false };\n  for (let index = 0; index < argumentsList.length; index += 1) {\n    const argument = argumentsList[index];\n    if (argument === '--json') options = { ...options, json: true };\n    else if (argument === '--install-dir') {\n      const value = argumentsList[index + 1];\n      if (!value || value.startsWith('--')) throw new Error('Missing value for --install-dir.');\n      options = { ...options, installDir: validateInstallDirectory(value) };\n      index += 1;\n    } else throw new Error(`Unknown Nasiko status argument: ${argument}`);\n  }\n  return options;\n}\n\nasync function main(argumentsList = process.argv.slice(2)) {\n  const [command, ...rest] = argumentsList;\n  if (!command || command === '--help' || command === '-h' || command === 'help') {\n    process.stdout.write(helpText());\n    return 0;\n  }\n  if (command === 'status') {\n    const options = parseStatusArguments(rest);\n    const status = readStatus(options);\n    if (options.json) process.stdout.write(`${JSON.stringify(status, null, 2)}\\n`);\n    else process.stdout.write(status.qualified","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/nasiko.js#L75-L111","documentation":"parseStatusArguments accepts --json and --install-dir for the `nasiko status` command. When --install-dir is given but the next argument is missing or is itself a flag (starts with '--'), the parser throws this error because the flag value cannot be determined. This prevents flags from being silently consumed as values.","triggerScenarios":"Running `nasiko status --install-dir` with nothing after it, or `nasiko status --install-dir --json`, where '--json' is misread as the directory value; likewise passing '--install-dir' as the final argument.","commonSituations":"Truncating a copied command line and dropping the directory path; reordering flags so --install-dir lands last before another flag; scripts that interpolate an empty INSTALL_DIR variable, e.g. `--install-dir $DIR` with DIR unset.","solutions":["Provide the directory path immediately after --install-dir: `nasiko status --install-dir /path/to/dir`.","Reorder flags so a value-bearing flag is not adjacent to another flag without its value.","In scripts, guard shell variables: `--install-dir \"${DIR:?DIR not set}\"`.","Quote the path if it contains spaces."],"exampleFix":"// before\nnasiko status --install-dir --json\n// after\nnasiko status --install-dir ~/.nasiko --json","handlingStrategy":"validation","validationCode":"const i = args.indexOf('--install-dir');\nif (i !== -1 && (!args[i+1] || args[i+1].startsWith('--'))) throw new Error('--install-dir needs a directory path immediately after it');","typeGuard":null,"tryCatchPattern":"try {\n  runNasiko(['status','--install-dir', dir]);\n} catch (err) {\n  if (err.message === 'Missing value for --install-dir.') {\n    console.error('Supply a directory path right after --install-dir.');\n  } else throw err;\n}","preventionTips":["Always place the directory value immediately after --install-dir.","Never let --install-dir be the last argument when other flags may follow.","In shell, use parameter guards like \"${DIR:?DIR not set}\".","Quote paths containing spaces."],"tags":["cli","missing-argument","parsing"],"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"}