affaan-m/ECC · error · Error
--json may only be provided once
Error message
--json may only be provided once
What it means
parseArgs counts occurrences of the --json flag; providing it more than once throws this error. The flag is a toggle for JSON output and duplicates are treated as a caller mistake rather than silently deduplicated.
Solutions
- Remove the duplicate --json so it appears at most once
- In wrapper scripts, deduplicate before invoking: args = [...new Set(args.filter(a => a !== '--json')), ...(needsJson ? ['--json'] : [])]
- Check where defaults and user args are merged and de-dupe the flag there
Example fix
// before
const args = [...baseArgs, '--json', ...userArgs]; // userArgs already has --json
// after
const args = baseArgs.includes('--json') || userArgs.includes('--json')
? [...baseArgs, ...userArgs.filter(a => a !== '--json'), '--json']
: [...baseArgs, ...userArgs]; Defensive patterns
Strategy: validation
Validate before calling
function dedupeJson(args) {
const count = args.filter(a => a === '--json').length;
if (count > 1) throw new Error('--json provided more than once');
return args;
} Try / catch
try {
runIto(args);
} catch (e) {
if (e.message === '--json may only be provided once') {
runIto([...new Set(args.filter(a => a !== '--json')), '--json']);
} else throw e;
} Prevention
- Merge default flag arrays and user flags with de-duplication
- Let wrapper scripts own the --json flag instead of layering defaults on user input
- Lint argv construction helpers to reject duplicate toggles
When it happens
Trigger: Running `ecc ito status --json --json`, or composing argument arrays in scripts where both a wrapper and the inner command append --json, resulting in two occurrences.
Common situations: Shell wrappers that prepend their own --json on top of a user-supplied one; concatenating default flags arrays with user flags containing --json; fat-fingering the flag twice.
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
- all overlays must be readable local files
- all takes must be readable local files
- Arguments must not contain NUL bytes.
- asset name must be a simple filename stem (letters, digits…
- At least one guided harness must be selected
AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16).
Data as JSON: /api/errors/1fa29443c5cd590a.
Report an issue: GitHub.
Appendix: source
Thrown at scripts/ito.js:161
if (
args.length === 0
|| args.includes("--help")
|| args.includes("-h")
) {
return Object.freeze({ help: true, invocationArgs: [] });
}
if (environment.ECC_DRY_RUN === "1" || args.includes("--dry-run")) {
throw new Error(
"Itô compute has no paper or dry-run success mode. No CLI operation was invoked."
);
}
const jsonIndexes = args
.map((value, index) => (value === "--json" ? index : -1))
.filter((index) => index >= 0);
if (jsonIndexes.length > 1) {
throw new Error("--json may only be provided once");
}
const withoutJson = args.filter((value) => value !== "--json");
const command = withoutJson.shift();
if (!SUPPORTED_COMMANDS.includes(command)) {
throw new Error(
`Unsupported Itô command "${command || "(missing)"}"; ECC permits only login, logout, auth, find, status, and evals.`
);
}
if (command === "auth" && withoutJson.includes("--no-browser")) {
throw new Error("--no-browser is valid only for ecc ito login; auth is validation-only.");
}
if (command === "evals") {
validateNodeQualificationArgs(withoutJson, environment);
}
return Object.freeze({
help: false,
invocationArgs: Object.freeze([View on GitHub (pinned to 8321021c54)