{"record":{"id":"8edad471abf2ce44","repo":"affaan-m/ECC","slug":"unknown-memory-command-command","errorCode":null,"errorMessage":"Unknown memory command: ${command}","messagePattern":"Unknown memory command: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/memory.js","lineNumber":478,"sourceCode":"  read: runReadCommand,\n  save: runWriteCommand,\n  search: runSearchCommand,\n});\n\nfunction runCommand(parsed) {\n  const { command, options, positionals } = parsed;\n  if (options.help || command === 'help') {\n    process.stdout.write(usage());\n    return;\n  }\n  if (['init', 'save', 'handoff'].includes(command)) {\n    assertMutationAllowed(command);\n  }\n  const roots = resolveVaultRoots();\n  const handler = Object.hasOwn(COMMAND_HANDLERS, command)\n    ? COMMAND_HANDLERS[command]\n    : null;\n  if (!handler) throw new Error(`Unknown memory command: ${command}`);\n  return handler({ command, options, positionals, roots });\n}\n\nfunction main(argv = process.argv.slice(2)) {\n  try {\n    runCommand(parseArgs(argv));\n  } catch (error) {\n    process.stderr.write(`Error: ${sanitizeTerminalText(error.message)}\\n`);\n    process.exitCode = 1;\n  }\n}\n\nif (require.main === module) {\n  main();\n}\n\nmodule.exports = {\n  main,","sourceCodeStart":460,"sourceCodeEnd":496,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/memory.js#L460-L496","documentation":"Thrown by runCommand in scripts/memory.js when the parsed command is not a key in COMMAND_HANDLERS. The dispatcher uses `Object.hasOwn(COMMAND_HANDLERS, command)`, so only the exact registered verbs are accepted: doctor, handoff, init, read, save, search (and `help` is handled earlier as a no-op). Anything else reaches the throw.","triggerScenarios":"Invoking the CLI with a typo or unsupported verb, e.g. `node scripts/memory.js list`, `wrtie`, or `get`. Passing a flag-like first token (starts with `--`) typically yields a null/undefined command that also falls through to this throw. Note `help`/`--help` is intercepted before this check.","commonSituations":"Typos in scripted or agent-driven invocations; assuming a command exists that was never implemented (e.g. `delete`, `update`, `list`); version skew where an older script calls a command renamed in a newer ECC release.","solutions":["Run `node scripts/memory.js help` to list the supported commands.","Correct the verb to one of: init, save, handoff, search, read, doctor.","If automating, pin the ECC version and assert the command name against the help output after upgrades."],"exampleFix":"// before\nnode scripts/memory.js list --scope project\n// after\nnode scripts/memory.js search --scope project \"\"","handlingStrategy":"validation","validationCode":"const MEMORY_COMMANDS = new Set(['init', 'save', 'handoff', 'search', 'read', 'doctor', 'help']);\nfunction assertKnownCommand(cmd) {\n  if (!MEMORY_COMMANDS.has(cmd)) throw new Error(`Unsupported memory command: ${cmd}. Known: ${[...MEMORY_COMMANDS].join(', ')}`);\n  return cmd;\n}","typeGuard":"function isMemoryCommand(value) {\n  return typeof value === 'string' && MEMORY_COMMANDS.has(value);\n}","tryCatchPattern":null,"preventionTips":["Centralize the allowed-commands set in a constant shared with your wrapper so drift is caught early.","After ECC upgrades, re-run `memory help` and update any scripted commands against the current list.","Treat an unknown command as a hard failure in CI rather than falling back."],"tags":["cli","memory","argument-validation","command-dispatch"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}