{"record":{"id":"e47532e5485cd716","repo":"affaan-m/ECC","slug":"unknown-nasiko-command-argument-argument","errorCode":null,"errorMessage":"Unknown Nasiko ${command} argument: ${argument}","messagePattern":"Unknown Nasiko (.+?) argument: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/nasiko.js","lineNumber":49,"sourceCode":"  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;\n}\n\nfunction defaultExecutablePath() {\n  const normalized = normalizePlatform();\n  if (normalized.os === 'windows') {\n    return process.env.LOCALAPPDATA\n      ? path.join(process.env.LOCALAPPDATA, 'nasiko', 'bin', normalized.binaryName)\n      : null;\n  }\n  return path.join(os.homedir(), '.local', 'bin', normalized.binaryName);\n}\n\nfunction resolveExecutable(options = {}) {","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/nasiko.js#L31-L67","documentation":"parseMutationArguments whitelists the flags it accepts (--version, --install-dir, --yes/-y, --dry-run, --json). Any other token reaches the final else branch and throws `Unknown Nasiko ${command} argument: ${argument}`. After parsing, it also enforces that --version was supplied. This error is specifically the unrecognized-argument branch.","triggerScenarios":"Passing an unsupported flag to a Nasiko mutation command (e.g. `--force`, `--verbose`, a combined `-vy`, or a misspelled `--installdir`), so the token falls into the else branch of parseMutationArguments.","commonSituations":"Copy-pasting flags from another CLI's install command; assuming combined short flags work; typos in long flags; scripts carrying over flags from an older version of the Nasiko script that accepted more options.","solutions":["Remove the unsupported flag; use only --version, --install-dir, --yes/-y, --dry-run, --json.","Fix flag spelling/separators: use `--install-dir`, not `--installdir`; pass short flags individually (`-y`, not `-vy`).","Check the script's argument parser (scripts/nasiko.js) for the current accepted flag set if docs are stale.","If behavior like --force is genuinely needed, extend parseMutationArguments with an explicit branch rather than passing unknown flags."],"exampleFix":"// before\nnode scripts/nasiko.js install --version v0.1.0 --force\n// after\nnode scripts/nasiko.js install --version v0.1.0 --yes","handlingStrategy":"validation","validationCode":"const ALLOWED = new Set(['--version', '--install-dir', '--yes', '-y', '--dry-run', '--json']);\nconst bad = args.filter((a) => a.startsWith('-') && !ALLOWED.has(a));\nif (bad.length) throw new Error(`Unsupported Nasiko flags: ${bad.join(', ')}`);","typeGuard":null,"tryCatchPattern":"try {\n  options = parseMutationArguments(args, command);\n} catch (err) {\n  if (String(err.message).startsWith('Unknown Nasiko')) {\n    console.error(`${err.message} Allowed: --version --install-dir --yes/-y --dry-run --json.`);\n    process.exitCode = 64;\n  } else throw err;\n}","preventionTips":["Restrict generated invocations to the whitelisted flag set.","Do not combine short flags; pass -y on its own.","Check for typos in long flags (--install-dir, not --installdir/--dir).","Diff flags against the parseMutationArguments whitelist when migrating scripts from other installers."],"tags":["cli","invalid-argument","argument-parsing"],"backgroundTag":"invalid-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"}