affaan-m/ECC · error

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

Error message

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

What it means

validateInteractiveJsonOptions throws this when the setup runs interactively with --json but needsInteractiveChoices(options) is true — i.e. mode, scope, or hooks would have to be asked via prompts. JSON output is machine-readable, so interactive prompts that would corrupt the stream are forbidden; all three values must be supplied explicitly via flags.

Solutions

  1. Pass all three values explicitly: `ecc setup --json --mode claude-plugin --scope project --hooks minimal`.
  2. Add --yes so no confirmation is needed (see the companion --yes error).
  3. Use --dry-run with --json to inspect without mutations if you cannot supply every flag.

Example fix

// before
npm run setup -- --json

// after
npm run setup -- --json --mode claude-plugin --scope project --hooks minimal --yes
Defensive patterns

Strategy: validation

Validate before calling

const needsInteractiveChoices = (o) => o.mode === undefined || o.scope === undefined || o.hooks === undefined;
if (useJson && needsInteractiveChoices(opts)) {
  throw new Error('Interactive --json requires explicit --mode, --scope, and --hooks values.');
}

Try / catch

try {
  await runSetup(rawArgs);
} catch (err) {
  if (err.message.includes('Interactive --json requires')) {
    console.error(err.message);
    process.exitCode = 2;
  } else throw err;
}

Prevention

When it happens

Trigger: Running `ecc setup --json` (or with --json plus missing flags) in a TTY where --scope or --hooks is not explicitly provided, so the tool would need to prompt for choices.

Common situations: Wrapping setup in a script that parses stdout while omitting flags, expecting defaults; running --json without --mode/--scope/--hooks; assuming interactive prompts and JSON output can coexist.

Understand the failure class

Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.

Related errors


AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16). Data as JSON: /api/errors/ffc69348a46d1380. Report an issue: GitHub.

Appendix: 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 8321021c54)