affaan-m/ECC · error · Error

Unknown memory command: ${command}

Error message

Unknown memory command: ${command}

What it means

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.

Source

Thrown at scripts/memory.js:478

  read: runReadCommand,
  save: runWriteCommand,
  search: runSearchCommand,
});

function runCommand(parsed) {
  const { command, options, positionals } = parsed;
  if (options.help || command === 'help') {
    process.stdout.write(usage());
    return;
  }
  if (['init', 'save', 'handoff'].includes(command)) {
    assertMutationAllowed(command);
  }
  const roots = resolveVaultRoots();
  const handler = Object.hasOwn(COMMAND_HANDLERS, command)
    ? COMMAND_HANDLERS[command]
    : null;
  if (!handler) throw new Error(`Unknown memory command: ${command}`);
  return handler({ command, options, positionals, roots });
}

function main(argv = process.argv.slice(2)) {
  try {
    runCommand(parseArgs(argv));
  } catch (error) {
    process.stderr.write(`Error: ${sanitizeTerminalText(error.message)}\n`);
    process.exitCode = 1;
  }
}

if (require.main === module) {
  main();
}

module.exports = {
  main,

View on GitHub (pinned to 01e15490f0)

Solutions

  1. Run `node scripts/memory.js help` to list the supported commands.
  2. Correct the verb to one of: init, save, handoff, search, read, doctor.
  3. If automating, pin the ECC version and assert the command name against the help output after upgrades.

Example fix

// before
node scripts/memory.js list --scope project
// after
node scripts/memory.js search --scope project ""
Defensive patterns

Strategy: validation

Validate before calling

const MEMORY_COMMANDS = new Set(['init', 'save', 'handoff', 'search', 'read', 'doctor', 'help']);
function assertKnownCommand(cmd) {
  if (!MEMORY_COMMANDS.has(cmd)) throw new Error(`Unsupported memory command: ${cmd}. Known: ${[...MEMORY_COMMANDS].join(', ')}`);
  return cmd;
}

Type guard

function isMemoryCommand(value) {
  return typeof value === 'string' && MEMORY_COMMANDS.has(value);
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13). Data as JSON: /api/errors/8edad471abf2ce44. Report an issue: GitHub.