affaan-m/ECC · error · Error

Missing value for --install-dir.

Error message

Missing value for --install-dir.

What it means

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.

Solutions

  1. Provide the directory path immediately after --install-dir: `nasiko status --install-dir /path/to/dir`.
  2. Reorder flags so a value-bearing flag is not adjacent to another flag without its value.
  3. In scripts, guard shell variables: `--install-dir "${DIR:?DIR not set}"`.
  4. Quote the path if it contains spaces.

Example fix

// before
nasiko status --install-dir --json
// after
nasiko status --install-dir ~/.nasiko --json
Defensive patterns

Strategy: validation

Validate before calling

const i = args.indexOf('--install-dir');
if (i !== -1 && (!args[i+1] || args[i+1].startsWith('--'))) throw new Error('--install-dir needs a directory path immediately after it');

Try / catch

try {
  runNasiko(['status','--install-dir', dir]);
} catch (err) {
  if (err.message === 'Missing value for --install-dir.') {
    console.error('Supply a directory path right after --install-dir.');
  } else throw err;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "no subcommand specified" and "... is required": CLI errors when a required argument is missing — this error's family across 13 libraries.

Related errors


AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16). Data as JSON: /api/errors/cade4175ec9b4cac. Report an issue: GitHub.

Appendix: source

Thrown at scripts/nasiko.js:93

    throw new Error('ECC_NASIKO_CLI_EXECUTABLE must be an absolute path.');
  }
  return candidate;
}

function readStatus(options = {}) {
  const executable = resolveExecutable(options);
  if (!executable) return { installed: false, qualified: false, version: null, executable: null };
  return inspectInstalledNasiko(executable);
}

function parseStatusArguments(argumentsList) {
  let options = { installDir: undefined, json: false };
  for (let index = 0; index < argumentsList.length; index += 1) {
    const argument = argumentsList[index];
    if (argument === '--json') options = { ...options, json: true };
    else if (argument === '--install-dir') {
      const value = argumentsList[index + 1];
      if (!value || value.startsWith('--')) throw new Error('Missing value for --install-dir.');
      options = { ...options, installDir: validateInstallDirectory(value) };
      index += 1;
    } else throw new Error(`Unknown Nasiko status argument: ${argument}`);
  }
  return options;
}

async function main(argumentsList = process.argv.slice(2)) {
  const [command, ...rest] = argumentsList;
  if (!command || command === '--help' || command === '-h' || command === 'help') {
    process.stdout.write(helpText());
    return 0;
  }
  if (command === 'status') {
    const options = parseStatusArguments(rest);
    const status = readStatus(options);
    if (options.json) process.stdout.write(`${JSON.stringify(status, null, 2)}\n`);
    else process.stdout.write(status.qualified

View on GitHub (pinned to 8321021c54)