affaan-m/ECC · error · Error

Interactive --json requires explicit --mode, --scope, and --

Error message

Interactive --json requires explicit --mode, --scope, and --hooks values.

What it means

Thrown by validateInteractiveJsonOptions when --json is used in an interactive context but at least one of --mode, --scope, --hooks is still undefined. The JSON output must be deterministic and not depend on prompt answers, so all three must be supplied explicitly on the command line.

Source

Thrown at scripts/setup.js:353

function isInteractiveCancellation(error) {
  return Boolean(error && (
    error.code === 'ABORT_ERR'
    || /aborted with ctrl\+d|readline was closed/i.test(error.message || '')
  ));
}

function needsInteractiveChoices(options) {
  return (
    options.mode === undefined
    || options.scope === undefined
    || options.hooks === undefined
  );
}

function validateInteractiveJsonOptions(options, interactive) {
  if (!interactive || !options.json) return;
  if (needsInteractiveChoices(options)) {
    throw new Error(
      'Interactive --json requires explicit --mode, --scope, and --hooks values.'
    );
  }
  if (!options.yes && !options.dryRun) {
    throw new Error('Interactive --json mutations require --yes.');
  }
}

function reconcileClaudePlugin(options) {
  const setupOptions = {
    dryRun: options.dryRun,
    hooks: options.hooks,
    scope: options.scope,
  };
  if (options.moveScope) {
    return migrateClaudePluginScope(setupOptions);
  }

View on GitHub (pinned to 01e15490f0)

Solutions

  1. Provide all three explicitly: `--json --mode claude-plugin --scope user --hooks standard`.
  2. Add --yes (and optionally --dry-run) to satisfy the mutation guard.
  3. Drop --json if you actually want the interactive prompt.

Example fix

# before
node scripts/setup.js --json --scope user
# after
node scripts/setup.js --json --mode claude-plugin --scope user --hooks standard --yes
Defensive patterns

Strategy: validation

Validate before calling

const argv = process.argv.slice(2);
if (argv.includes('--json')) {
  const has = name => argv.some(a => a.startsWith(name));
  if (!(has('--mode') && has('--scope') && has('--hooks'))) {
    console.error('Interactive --json needs --mode, --scope, and --hooks');
    process.exit(2);
  }
}

Try / catch

try { validateInteractiveJsonOptions(options, interactive); } catch (err) { console.error(err.message); process.exit(2); }

Prevention

When it happens

Trigger: Running `node scripts/setup.js --json` in a TTY without providing all of --mode/--scope/--hooks. needsInteractiveChoices() returns true because one is missing, and the guard aborts.

Common situations: Wiring setup.js into CI/automation with --json but expecting prompts; providing only --scope and --hooks and forgetting --mode.

Related errors


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