affaan-m/ECC · error

--json may only be provided once

Error message

--json may only be provided once

What it means

Thrown by parseArgs at scripts/ito.js:161 when the --json flag appears more than once in argv. The bridge forwards --json to the canonical Itô CLI exactly once (ito.js:180) and the JSON output mode is a single boolean toggle; passing it twice is treated as a malformed invocation rather than a no-op. This check runs before command validation, so it fires even for unknown commands.

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 01e15490f0)

Solutions

  1. Pass --json exactly once: `ecc ito status --json`.
  2. Check your shell alias / function for a hardcoded --json: `alias eitoj; type eitoj`.
  3. If a wrapper script toggles JSON via a variable, guard with `[ -n "$JSON" ] && set -- --json "$@"` rather than always appending.

Example fix

// before
$ ecc ito --json status --json
// after
$ ecc ito status --json
Defensive patterns

Strategy: validation

Validate before calling

function dedupeJsonFlag(argv) {
  const count = argv.filter(a => a === '--json').length;
  if (count > 1) throw new Error(`--json passed ${count} times; expected at most 1`);
  return argv;
}
// before invoking ecc ito
dedupeJsonFlag(args);

Prevention

When it happens

Trigger: `ecc ito status --json --json`; `ecc ito --json find <opts> --json`; any invocation where the args array contains the literal token '--json' at two or more positions.

Common situations: A wrapper script appends --json unconditionally and the operator also types it; or a shell alias includes --json and the user adds it again. Aliases like `alias eitoj='ecc ito --json'` combined with `eitoj status --json` are the most common cause.

Related errors


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