affaan-m/ECC · error · Error
does not accept positional arguments.
Error message
${command} does not accept positional arguments. What it means
requireNoPositionals enforces that subcommands like init, write, and doctor in scripts/memory.js take only named options, never bare positional arguments. If any positional tokens survive parsing, the command throws '<command> does not accept positional arguments.' This keeps the CLI contract strict and prevents silently ignoring stray arguments.
Solutions
- Remove the stray positional and express the intent as an option: `--content` / `--tags` etc.
- If you meant to reference a file, check whether an option like --file exists; otherwise pipe the file via stdin (the script reads stdin for write).
- Check shell quoting so a single flag value does not split into extra tokens.
- Run `node scripts/memory.js --help` to see the accepted subcommand signatures.
Example fix
// before node scripts/memory.js write note.md --content "x" // after echo "x" | node scripts/memory.js write --tags note
Defensive patterns
Strategy: validation
Validate before calling
const COMMANDS_NO_POSITIONALS = new Set(['init','write','doctor']);
const positionals = args.filter(a => !a.startsWith('--') && a !== command);
if (COMMANDS_NO_POSITIONALS.has(command) && positionals.length) throw new Error(`${command} takes no positional args`); Try / catch
try { run(args); } catch (e) { if (e.message.includes('does not accept positional arguments')) { console.error('Use named options instead of positional arguments'); process.exitCode = 2; } else throw e; } Prevention
- Review subcommand signatures before scripting
- Quote flag values so they don't split into positionals
- Pipe file contents via stdin instead of passing paths
When it happens
Trigger: Running `node scripts/memory.js write somefile.md --content "x"` or `node scripts/memory.js init default` — the bare tokens 'somefile.md'/'default' are positionals.
Common situations: Assuming the script accepts a file path argument like other tools, pasting commands from a different CLI, or an unquoted flag value that got split so part of it became positional.
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
- requires a value.
- --exit-code with --watch requires --watch-count so the…
- must be a positive integer
- requires a value
- requires a value
AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16).
Data as JSON: /api/errors/79eff2ba82788459.
Report an issue: GitHub.
Appendix: source
Thrown at scripts/memory.js:135
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) {
if (!values || values.length === 0) return fallback;
if (values.length > 1) {
throw new Error(`${label} may be provided only once.`);
}
return values[0];
}
function waitForStdinRetry(milliseconds) {
Atomics.wait(STDIN_RETRY_SIGNAL, 0, 0, milliseconds);
}
function readBoundedStdin(maxBytes, retryOptions = {}) {
const retryDelayMs = Number.isInteger(retryOptions.retryDelayMs)
&& retryOptions.retryDelayMs > 0View on GitHub (pinned to 8321021c54)