affaan-m/ECC · warning · Error

Unknown option: ${argument}

Error message

Unknown option: ${argument}

What it means

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.

Source

Thrown at scripts/memory.js:121

      };
    }
    const valueKey = VALUE_OPTIONS.get(argument);
    const repeatKey = REPEAT_OPTIONS.get(argument);
    if (valueKey || repeatKey) {
      const value = args[index + 1];
      if (value === undefined || value.startsWith('--')) {
        throw new Error(`${argument} requires a value.`);
      }
      return {
        ...state,
        options: repeatKey
          ? appendOption(state.options, repeatKey, value)
          : { ...state.options, [valueKey]: value },
        skipNext: true,
      };
    }
    if (argument.startsWith('-')) {
      throw new Error(`Unknown option: ${argument}`);
    }
    return { ...state, positionals: [...state.positionals, argument] };
  }, { options: {}, positionals: [], skipNext: false });

  return {
    command,
    options: parsed.options,
    positionals: parsed.positionals,
  };
}

function requireNoPositionals(positionals, command) {
  if (positionals.length > 0) {
    throw new Error(`${command} does not accept positional arguments.`);
  }
}

function oneValue(values, label, fallback = null) {

View on GitHub (pinned to 01e15490f0)

Solutions

  1. Run `ecc memory` (no args) to print the usage block listing every supported flag.
  2. Use `--kind` not `--type`; `--target` (singular, repeatable) not `--targets`; `--title`, `--body-file`, `--from`, `--limit`, `--source-harness`, `--target-harness` for single values.
  3. Drop any dash-prefixed positional you did not mean as a flag.

Example fix

# before
ecc memory save --targets claude-code --title x --stdin

# after
ecc memory save --target claude-code --title x --stdin
Defensive patterns

Strategy: validation

Validate before calling

const KNOWN = new Set(['--help','-h','--json','--stdin','--body-file','--from','--limit','--source-harness','--target-harness','--title','--kind','--link','--scope','--tag','--target']);
function validateMemoryArgs(argv) {
  for (const a of argv) { if (a.startsWith('-') && !KNOWN.has(a)) throw new Error(`Unknown option: ${a}`); }
}

Try / catch

try { parseArgs(process.argv); }
catch (err) { if (/Unknown option:/.test(err.message)) { console.error(err.message); usage(2); } else throw err; }

Prevention

When it happens

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

Common situations: Forgetting the exact option name. Auto-complete suggesting a similar but wrong flag. Mixing memory.js flags with loop-status.js flags.

Related errors


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