affaan-m/ECC · error · Error
may be provided only once.
Error message
${label} may be provided only once. What it means
oneValue in scripts/memory.js normalizes options that may appear at most once (e.g. a single --content or --status). Passing the same single-value option more than once yields '<label> may be provided only once.' The script refuses to guess which duplicate to keep.
Solutions
- Provide the option only once, keeping the value you actually want.
- Deduplicate flags in your wrapper script before invoking memory.js (e.g. keep the last occurrence).
- If you want multiple values, check whether a repeatable option exists (REPEAT_OPTIONS, e.g. --tags) and use that instead.
- Review generated command lines (CI logs) for duplicated flags from config merging.
Example fix
// before node scripts/memory.js write --content "a" --content "b" // after node scripts/memory.js write --content "b"
Defensive patterns
Strategy: validation
Validate before calling
const count = (arr, v) => arr.filter(a => a === v).length;
if (count(args, '--content') > 1) throw new Error('--content may be provided only once'); Try / catch
try { run(args); } catch (e) { if (e.message.includes('may be provided only once')) { console.error(`${e.message} Remove the duplicate flag.`); process.exitCode = 2; } else throw e; } Prevention
- Deduplicate flags when merging defaults with user input
- Use repeatable options (e.g. --tags) for multi-value needs
- Log the final argv in wrapper scripts for debugging
When it happens
Trigger: Running `node scripts/memory.js write --content "a" --content "b"` or repeating another single-value option tracked by oneValue via saveInput.
Common situations: Shell scripts appending flags in a loop without deduplicating, concatenating default flags with user-supplied flags, or typos where two similar flags both map to the same label.
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.
- does not accept positional arguments.
- --exit-code with --watch requires --watch-count so the…
- must be a positive integer
- requires a value
AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16).
Data as JSON: /api/errors/d4e96750441472be.
Report an issue: GitHub.
Appendix: source
Thrown at scripts/memory.js:142
}, { 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 > 0
? retryOptions.retryDelayMs
: DEFAULT_STDIN_RETRY_DELAY_MS;
const maxRetryWaitMs = Number.isInteger(retryOptions.maxRetryWaitMs)
&& retryOptions.maxRetryWaitMs >= 0
? retryOptions.maxRetryWaitMs
: MAX_STDIN_RETRY_WAIT_MS;
const wait = typeof retryOptions.wait === 'function'View on GitHub (pinned to 8321021c54)