affaan-m/ECC · error · Error

Interactive setup requires a terminal. Pass --mode claude-pl

Error message

Interactive setup requires a terminal. Pass --mode claude-plugin and the required flags.

What it means

Thrown by setup.js when stdin is not a TTY (non-interactive), the user did not pass --mode, and there is no interactive path available. Without a terminal the script cannot prompt for the missing mode/scope/hooks, so it refuses to proceed and points the user at the required flags.

Source

Thrown at scripts/setup.js:426

    const shouldCollectInteractiveChoices = needsInteractiveChoices(options);
    const needsConfirmation = !options.yes && !options.dryRun;
    const interactiveDefaults = interactive
      && (shouldCollectInteractiveChoices || needsConfirmation)
      ? resolveInteractiveDefaults()
      : undefined;
    if (interactive && shouldCollectInteractiveChoices) {
      terminal = readline.createInterface({
        input: process.stdin,
        output: process.stdout,
      });
      options = await collectInteractiveOptions(
        options,
        interactiveDefaults,
        terminal
      );
    } else if (!options.mode) {
      if (!interactive) {
        throw new Error(
          'Interactive setup requires a terminal. Pass --mode claude-plugin and the required flags.'
        );
      }
    }

    if (interactiveDefaults) {
      const confirmationAction = interactiveDefaults.multipleScopes
        ? 'Resume migration'
        : (
          interactiveDefaults.installed && interactiveDefaults.scope !== options.scope
            ? 'Migrate'
            : 'Apply'
        );
      options = {
        ...options,
        confirmationAction,
      };
    }

View on GitHub (pinned to 01e15490f0)

Solutions

  1. Pass the full non-interactive flag set: `--mode claude-plugin --scope user --hooks standard --yes`.
  2. Allocate a TTY (e.g. `docker run -it`, `script -q`) if you want prompts.
  3. Combine with --json for machine-readable output in automation.

Example fix

# before
node scripts/setup.js   # inside CI, no TTY
# after
node scripts/setup.js --mode claude-plugin --scope user --hooks standard --yes
Defensive patterns

Strategy: validation

Validate before calling

if (!process.stdin.isTTY && !process.argv.includes('--mode')) {
  console.error('Non-interactive shell: pass --mode claude-plugin and required flags');
  process.exit(2);
}

Type guard

function isInteractive() { return Boolean(process.stdin.isTTY); }

Try / catch

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

Prevention

When it happens

Trigger: Running `node scripts/setup.js` in CI, a Docker container, or any pipe (stdin not a TTY) without --mode and the supporting flags.

Common situations: First-time install in a fresh container; piping yes/no into the script; running under a scheduler that provides no TTY.

Related errors


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