{"record":{"id":"1c67dad9a9d5d40a","repo":"affaan-m/ECC","slug":"missing-value-for-argument-1c67da","errorCode":null,"errorMessage":"Missing value for ${argument}.","messagePattern":"Missing value for (.+?)\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/nasiko.js","lineNumber":36,"sourceCode":"Usage:\n  ecc nasiko status [--install-dir <absolute-path>] [--json]\n  ecc nasiko install --version v0.1.0 --yes [--install-dir <absolute-path>] [--json]\n  ecc nasiko install --version v0.1.0 --dry-run [--install-dir <absolute-path>] [--json]\n  ecc nasiko uninstall --version v0.1.0 --yes [--install-dir <absolute-path>] [--json]\n\nThe installer is opt-in, accepts only ECC-qualified pinned releases, downloads\ncontent-addressed OCI artifacts from registry.nasiko.dev, verifies SHA-256\ndigests before extraction, and never executes fetched shell or PowerShell code.\n`;\n}\n\nfunction parseMutationArguments(argumentsList, command = 'install') {\n  let options = { dryRun: false, installDir: undefined, json: false, version: undefined, yes: false };\n  for (let index = 0; index < argumentsList.length; index += 1) {\n    const argument = argumentsList[index];\n    if (argument === '--version' || argument === '--install-dir') {\n      const value = argumentsList[index + 1];\n      if (!value || value.startsWith('--')) throw new Error(`Missing value for ${argument}.`);\n      options = {\n        ...options,\n        [argument === '--version' ? 'version' : 'installDir']: value,\n      };\n      index += 1;\n    } else if (argument === '--yes' || argument === '-y') {\n      options = { ...options, yes: true };\n    } else if (argument === '--dry-run') {\n      options = { ...options, dryRun: true };\n    } else if (argument === '--json') {\n      options = { ...options, json: true };\n    } else {\n      throw new Error(`Unknown Nasiko ${command} argument: ${argument}`);\n    }\n  }\n  if (!options.version) throw new Error(`Nasiko ${command} requires --version v0.1.0.`);\n  if (options.installDir) validateInstallDirectory(options.installDir);\n  return options;","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/nasiko.js#L18-L54","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Provide a value directly after the flag: `--version v0.1.0 --install-dir /path/to/dir`.","Guard shell variables: `--install-dir \"${INSTALL_DIR:?install dir required}\"` so empties fail before the CLI runs.","Reorder arguments so value flags are not last in generated command strings.","In wrapper scripts, assert the value token exists and does not start with '--' before exec."],"exampleFix":"// before\nnode scripts/nasiko.js install --version v0.1.0 --install-dir --yes\n// after\nnode scripts/nasiko.js install --version v0.1.0 --install-dir /opt/nasiko --yes","handlingStrategy":"validation","validationCode":"for (const flag of ['--version', '--install-dir']) {\n  const i = args.indexOf(flag);\n  if (i !== -1 && (!args[i + 1] || args[i + 1].startsWith('--'))) {\n    throw new Error(`${flag} needs a value (got: ${args[i + 1] ?? 'nothing'}).`);\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  options = parseMutationArguments(args, command);\n} catch (err) {\n  if (String(err.message).startsWith('Missing value for')) {\n    console.error(`${err.message} Pass e.g. --install-dir /opt/nasiko.`);\n    process.exitCode = 64;\n  } else throw err;\n}","preventionTips":["Interpolate values with `${VAR:?msg}` so empty variables abort before the CLI runs.","Keep value-taking flags away from the end of generated argument lists.","Quote paths: --install-dir \"/opt/my dir\"."],"tags":["cli","missing-argument","argument-parsing"],"backgroundTag":"missing-flag-value","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"}