{"record":{"id":"eb454ba8fc93ccd7","repo":"affaan-m/ECC","slug":"unknown-option-argument","errorCode":null,"errorMessage":"Unknown option: ${argument}","messagePattern":"Unknown option: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/memory.js","lineNumber":121,"sourceCode":"      };\n    }\n    const valueKey = VALUE_OPTIONS.get(argument);\n    const repeatKey = REPEAT_OPTIONS.get(argument);\n    if (valueKey || repeatKey) {\n      const value = args[index + 1];\n      if (value === undefined || value.startsWith('--')) {\n        throw new Error(`${argument} requires a value.`);\n      }\n      return {\n        ...state,\n        options: repeatKey\n          ? appendOption(state.options, repeatKey, value)\n          : { ...state.options, [valueKey]: value },\n        skipNext: true,\n      };\n    }\n    if (argument.startsWith('-')) {\n      throw new Error(`Unknown option: ${argument}`);\n    }\n    return { ...state, positionals: [...state.positionals, argument] };\n  }, { options: {}, positionals: [], skipNext: false });\n\n  return {\n    command,\n    options: parsed.options,\n    positionals: parsed.positionals,\n  };\n}\n\nfunction requireNoPositionals(positionals, command) {\n  if (positionals.length > 0) {\n    throw new Error(`${command} does not accept positional arguments.`);\n  }\n}\n\nfunction oneValue(values, label, fallback = null) {","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/memory.js#L103-L139","documentation":"parseArgs in scripts/memory.js treats any token starting with '-' that is not a known option as invalid and throws 'Unknown option: <argument>'. Known non-value tokens fall through to positional handling, but hyphen-prefixed unknowns are rejected so typos and cross-script flags fail fast.","triggerScenarios":"Running `node scripts/memory.js write --contents \"x\"` (typo), `--force` (unsupported flag), or `node scripts/memory.js -x`.","commonSituations":"Typos in long flags, copying flags from loop-status.js or other ECC scripts, using short flags the script does not define.","solutions":["Verify the flag against memory.js's supported options (--once, --tags, --content, --status, etc.) and correct the spelling.","Remove unsupported flags; the script intentionally has a minimal surface.","Check for double vs single dash confusion for any short options.","Consult the script's usage/docs for the exact option names for the chosen subcommand (init/write/doctor)."],"exampleFix":"// before\nnode scripts/memory.js write --contnt \"note\"\n// after\nnode scripts/memory.js write --content \"note\"","handlingStrategy":"validation","validationCode":"const KNOWN = new Set(['--once','--content','--tags','--status']);\nconst bad = args.filter(a => /^-/.test(a) && !KNOWN.has(a));\nif (bad.length) throw new Error(`Unknown option(s): ${bad.join(', ')}`);","typeGuard":null,"tryCatchPattern":"try { run(args); } catch (e) { if (e.message.startsWith('Unknown option:')) { console.error(`${e.message} — check memory.js flag names`); process.exitCode = 2; } else throw e; }","preventionTips":["Document the accepted flags per subcommand","Don't share flag lists between loop-status.js and memory.js","Add a dry-run/arg-check step in wrapper scripts"],"tags":["cli","argument-parsing","unknown-option"],"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"}