affaan-m/ECC · warning · Error

${label} may be provided only once.

Error message

${label} may be provided only once.

What it means

oneValue enforces that a single-value option (from VALUE_OPTIONS: --body-file, --from, --limit, --source-harness, --target-harness, --title) appears at most once. If the same flag is given twice it throws `${label} may be provided only once.` The repeatable flags (--kind, --link, --scope, --tag, --target) are intentionally excluded because they go through appendOption, so this only governs the non-repeatable set.

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

Solutions

  1. Provide each single-value option exactly once.
  2. Dedupe args in wrapper scripts before invoking memory.
  3. Remember --kind/--tag/--link/--scope/--target are the repeatable ones; the others are not.
  4. If you need to override, edit the previous occurrence rather than appending another.

Example fix

# before
ecc memory save --title "A" --title "B" --stdin

# after
ecc memory save --title "A" --stdin
Defensive patterns

Strategy: validation

Validate before calling

const SINGLE_VALUE = new Set(['--body-file','--from','--limit','--source-harness','--target-harness','--title']);
function assertSingleValueFlags(argv) {
  const counts = new Map();
  for (const a of argv) if (SINGLE_VALUE.has(a)) counts.set(a, (counts.get(a) || 0) + 1);
  for (const [flag, n] of counts) if (n > 1) throw new Error(`${flag} may be provided only once.`);
}

Try / catch

try { runCommand(parsed); }
catch (err) { if (/may be provided only once\./.test(err.message)) { usage(2); } else throw err; }

Prevention

When it happens

Trigger: Passing `--title a --title b`. A wrapper script concatenating two config sources each adding `--from ecc`. An alias plus an explicit flag both contributing `--target-harness`.

Common situations: Merging CLI args from multiple config layers without dedupe. Copy-pasting a flag twice. Shell history editing leaving a duplicate.

Related errors


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