{"record":{"id":"eb454ba8fc93ccd7","repo":"affaan-m/ECC","slug":"unknown-option-argument","errorCode":null,"errorMessage":"Unknown option: ${argument}","messagePattern":"Unknown option: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","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/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/memory.js#L103-L139","documentation":"After exhausting the BOOLEAN/VALUE/REPEAT option maps, memory.js treats any token starting with '-' as an unknown option and throws `Unknown option: <argument>`. Tokens not starting with '-' are collected as positionals (and may later trip requireNoPositionals). So this specific message means an unrecognized dash-prefixed flag.","triggerScenarios":"Typing `--jsonn`, `--scopee`, or a flag from another tool. Using single-dash long forms like `-title`. Passing `--type` instead of `--kind`. Passing `--targets` (plural) — note REPEAT_OPTIONS has `--target` singular, so plural is unknown.","commonSituations":"Forgetting the exact option name. Auto-complete suggesting a similar but wrong flag. Mixing memory.js flags with loop-status.js flags.","solutions":["Run `ecc memory` (no args) to print the usage block listing every supported flag.","Use `--kind` not `--type`; `--target` (singular, repeatable) not `--targets`; `--title`, `--body-file`, `--from`, `--limit`, `--source-harness`, `--target-harness` for single values.","Drop any dash-prefixed positional you did not mean as a flag."],"exampleFix":"# before\necc memory save --targets claude-code --title x --stdin\n\n# after\necc memory save --target claude-code --title x --stdin","handlingStrategy":"validation","validationCode":"const KNOWN = new Set(['--help','-h','--json','--stdin','--body-file','--from','--limit','--source-harness','--target-harness','--title','--kind','--link','--scope','--tag','--target']);\nfunction validateMemoryArgs(argv) {\n  for (const a of argv) { if (a.startsWith('-') && !KNOWN.has(a)) throw new Error(`Unknown option: ${a}`); }\n}","typeGuard":null,"tryCatchPattern":"try { parseArgs(process.argv); }\ncatch (err) { if (/Unknown option:/.test(err.message)) { console.error(err.message); usage(2); } else throw err; }","preventionTips":["Remember --kind not --type; --target (singular, repeatable) not --targets.","Validate against the option maps before invoking in wrappers.","Surface `ecc memory` usage to users on any parse error."],"tags":["cli","argument-parsing","memory-vault","usage"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}