affaan-m/ECC · error · Error

Non-interactive and JSON mutations require --yes.

Error message

Non-interactive and JSON mutations require --yes.

What it means

validateExecutionMode() requires explicit confirmation for any run that can mutate files without a human prompt. When the run is non-interactive or uses --json, mutations are only allowed with --yes (or harmlessly previewed with --dry-run). Without confirmation the script refuses to proceed.

Solutions

  1. Add --yes to acknowledge the mutations, e.g. at the end of the command.
  2. Add --dry-run instead if you only want a preview of what would be installed.
  3. Run the command interactively (TTY) if you want prompts instead of --yes.

Example fix

// before
node scripts/install-guided.js --harness claude --claude-scope project --claude-hooks standard
// after
node scripts/install-guided.js --harness claude --claude-scope project --claude-hooks standard --yes
Defensive patterns

Strategy: validation

Validate before calling

if ((!isInteractive || jsonMode) && !yes && !dryRun) { throw new Error('Pass --yes (or --dry-run) for non-interactive/JSON runs'); }

Try / catch

try { main(); } catch (e) { if (/require --yes/.test(e.message)) { console.error('Append --yes to apply changes, or --dry-run to preview'); process.exit(2); } throw e; }

Prevention

When it happens

Trigger: Running with non-interactive stdin or --json, with options.yes false and options.dryRun false, after harness selection passes.

Common situations: CI pipelines that forget --yes; JSON-mode tooling that parses a plan then applies it without --yes; users testing non-interactively expecting a dry-run by default.

Understand the failure class

Background: "--flag is required" and "must specify" CLI errors: how missing-required-flag validation works and how to fix it — this error's family across 20 libraries.

Related errors


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

Appendix: source

Thrown at scripts/install-guided.js:199

  if (options.allHarnesses) return normalizeHarnessSelection(['all']);
  if (options.harnesses.length === 0) return [];
  return normalizeHarnessSelection(options.harnesses);
}

function validateExecutionMode(options, interactive) {
  const harnesses = selectedHarnessIds(options);
  if (!interactive && harnesses.length === 0) {
    throw new Error('Non-interactive guided install requires at least one --harness.');
  }
  const requiresExplicit = !interactive || options.json;
  if (requiresExplicit && harnesses.includes('claude') && (!options.claudeScope || !options.claudeHooks)) {
    throw new Error('Claude requires explicit --claude-scope and --claude-hooks choices in this mode.');
  }
  if (requiresExplicit && harnesses.includes('kimi') && !options.profile) {
    throw new Error('Kimi requires an explicit --profile choice in this mode.');
  }
  if ((!interactive || options.json) && !options.yes && !options.dryRun) {
    throw new Error('Non-interactive and JSON mutations require --yes.');
  }
}

function printPlan(plan, output) {
  output.write('\nECC guided install preview\n\n');
  output.write('Harness       Channel           Destination\n');
  for (const entry of plan.harnesses) {
    const harness = getHarnessCapability(entry.id);
    output.write(`${harness.label.padEnd(13)} ${entry.channel.padEnd(17)} ${harness.destination}\n`);
  }
  if (plan.request.harnesses.includes('kimi')) {
    output.write('\nKimi note: ECC hooks are not configured; model, provider, and authentication settings are unchanged.\n');
  }
  if (plan.request.harnesses.includes('claude') && plan.request.claudeHooks && plan.request.claudeHooks !== 'off') {
    output.write(
      `\nClaude hook profile '${plan.request.claudeHooks}' enables automation that can:\n`
      + `${formatHookCapabilityDisclosure()}\n`
      + "Choose '--claude-hooks off' to install without automatic hook behavior.\n"

View on GitHub (pinned to 8321021c54)