affaan-m/ECC · error · Error

Missing value for .

Error message

Missing value for ${argument}.

What it means

parseMutationArguments in scripts/nasiko.js treats --version and --install-dir as value-taking flags. If the next token is missing or itself starts with '--', it throws `Missing value for ${argument}.`. The guard prevents flags from silently consuming other flags as their values.

Solutions

  1. Provide a value directly after the flag: `--version v0.1.0 --install-dir /path/to/dir`.
  2. Guard shell variables: `--install-dir "${INSTALL_DIR:?install dir required}"` so empties fail before the CLI runs.
  3. Reorder arguments so value flags are not last in generated command strings.
  4. In wrapper scripts, assert the value token exists and does not start with '--' before exec.

Example fix

// before
node scripts/nasiko.js install --version v0.1.0 --install-dir --yes
// after
node scripts/nasiko.js install --version v0.1.0 --install-dir /opt/nasiko --yes
Defensive patterns

Strategy: validation

Validate before calling

for (const flag of ['--version', '--install-dir']) {
  const i = args.indexOf(flag);
  if (i !== -1 && (!args[i + 1] || args[i + 1].startsWith('--'))) {
    throw new Error(`${flag} needs a value (got: ${args[i + 1] ?? 'nothing'}).`);
  }
}

Try / catch

try {
  options = parseMutationArguments(args, command);
} catch (err) {
  if (String(err.message).startsWith('Missing value for')) {
    console.error(`${err.message} Pass e.g. --install-dir /opt/nasiko.`);
    process.exitCode = 64;
  } else throw err;
}

Prevention

When it happens

Trigger: Running a Nasiko install/mutation command with `--version` or `--install-dir` as the last argument, or followed immediately by another flag (e.g. `--install-dir --yes`), or with an empty expansion (`--install-dir "$EMPTY"`). Raised in parseMutationArguments, called by the options builder.

Common situations: Unset shell variables interpolated as empty; arg lists built by scripts where the value got dropped; placing the value flag before boolean flags assuming it can default; copy-paste where the value line was lost.

Related errors


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

Appendix: source

Thrown at scripts/nasiko.js:36

Usage:
  ecc nasiko status [--install-dir <absolute-path>] [--json]
  ecc nasiko install --version v0.1.0 --yes [--install-dir <absolute-path>] [--json]
  ecc nasiko install --version v0.1.0 --dry-run [--install-dir <absolute-path>] [--json]
  ecc nasiko uninstall --version v0.1.0 --yes [--install-dir <absolute-path>] [--json]

The installer is opt-in, accepts only ECC-qualified pinned releases, downloads
content-addressed OCI artifacts from registry.nasiko.dev, verifies SHA-256
digests before extraction, and never executes fetched shell or PowerShell code.
`;
}

function parseMutationArguments(argumentsList, command = 'install') {
  let options = { dryRun: false, installDir: undefined, json: false, version: undefined, yes: false };
  for (let index = 0; index < argumentsList.length; index += 1) {
    const argument = argumentsList[index];
    if (argument === '--version' || argument === '--install-dir') {
      const value = argumentsList[index + 1];
      if (!value || value.startsWith('--')) throw new Error(`Missing value for ${argument}.`);
      options = {
        ...options,
        [argument === '--version' ? 'version' : 'installDir']: value,
      };
      index += 1;
    } else if (argument === '--yes' || argument === '-y') {
      options = { ...options, yes: true };
    } else if (argument === '--dry-run') {
      options = { ...options, dryRun: true };
    } else if (argument === '--json') {
      options = { ...options, json: true };
    } else {
      throw new Error(`Unknown Nasiko ${command} argument: ${argument}`);
    }
  }
  if (!options.version) throw new Error(`Nasiko ${command} requires --version v0.1.0.`);
  if (options.installDir) validateInstallDirectory(options.installDir);
  return options;

View on GitHub (pinned to 8321021c54)