affaan-m/ECC · error · Error

Unknown option

Error message

Unknown option: ${argument}

What it means

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.

Solutions

  1. Verify the flag against memory.js's supported options (--once, --tags, --content, --status, etc.) and correct the spelling.
  2. Remove unsupported flags; the script intentionally has a minimal surface.
  3. Check for double vs single dash confusion for any short options.
  4. Consult the script's usage/docs for the exact option names for the chosen subcommand (init/write/doctor).

Example fix

// before
node scripts/memory.js write --contnt "note"
// after
node scripts/memory.js write --content "note"
Defensive patterns

Strategy: validation

Validate before calling

const KNOWN = new Set(['--once','--content','--tags','--status']);
const bad = args.filter(a => /^-/.test(a) && !KNOWN.has(a));
if (bad.length) throw new Error(`Unknown option(s): ${bad.join(', ')}`);

Try / catch

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; }

Prevention

When it happens

Trigger: Running `node scripts/memory.js write --contents "x"` (typo), `--force` (unsupported flag), or `node scripts/memory.js -x`.

Common situations: Typos in long flags, copying flags from loop-status.js or other ECC scripts, using short flags the script does not define.

Understand the failure class

Background: "Unknown argument", "Invalid value", and "must be one of": invalid CLI argument errors explained — this error's family across 35 libraries.

Related errors


AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16). Data as JSON: /api/errors/eb454ba8fc93ccd7. Report an issue: GitHub.

Appendix: 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 8321021c54)