affaan-m/ECC · error

Invalid setup mode: . This command currently supports .

Error message

Invalid setup mode: ${options.mode}. This command currently supports ${MODE}.

What it means

parseArgs throws this when --mode is provided with a value other than the single supported mode 'claude-plugin' (MODE constant). The setup command currently only implements one installation backend, so any other mode string is rejected explicitly with the supported value named in the message.

Solutions

  1. Use `--mode claude-plugin` exactly (the only supported value).
  2. Omit --mode entirely; bare `ecc setup` is valid when a terminal is available.
  3. Run `ecc setup --help` to confirm the supported mode.

Example fix

// before
npm run setup -- --mode claude --scope project

// after
npm run setup -- --mode claude-plugin --scope project
Defensive patterns

Strategy: validation

Validate before calling

const MODE = 'claude-plugin';
if (modeArg !== undefined && modeArg !== MODE) {
  throw new Error(`Invalid setup mode: ${modeArg}. Supported: ${MODE}`);
}

Type guard

const isClaudePluginMode = (v) => v === 'claude-plugin';

Try / catch

try {
  await runSetup(rawArgs);
} catch (err) {
  if (/^Invalid setup mode: /.test(err.message)) {
    console.error(err.message);
    process.exitCode = 2;
  } else throw err;
}

Prevention

When it happens

Trigger: Running `ecc setup --mode vite`, `ecc setup --mode claude`, or `--mode full` — any --mode value that is not exactly the string 'claude-plugin'.

Common situations: Copying examples from other tools that use --mode; guessing at mode names; older docs or blog posts referencing modes that were since consolidated; scripting that interpolates a wrong MODE variable.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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

Appendix: source

Thrown at scripts/setup.js:104

      options[valueFlags.get(argument)] = value;
      index += 1;
    } else if (argument === '--yes' || argument === '-y') {
      options.yes = true;
    } else if (argument === '--dry-run') {
      options.dryRun = true;
    } else if (argument === '--move-scope') {
      options.moveScope = true;
    } else if (argument === '--json') {
      options.json = true;
    } else if (argument === '--help' || argument === '-h') {
      options.help = true;
    } else {
      throw new Error(`Unknown argument: ${argument}`);
    }
  }

  if (options.mode !== undefined && options.mode !== MODE) {
    throw new Error(`Invalid setup mode: ${options.mode}. This command currently supports ${MODE}.`);
  }
  if (options.scope !== undefined && !VALID_SCOPES.has(options.scope)) {
    throw new Error(`Invalid --scope value: ${options.scope}`);
  }
  if (options.hooks !== undefined && !VALID_HOOK_MODES.has(options.hooks)) {
    throw new Error(`Invalid --hooks value: ${options.hooks}`);
  }
  if (options.moveScope && options.scope === undefined) {
    throw new Error('--move-scope requires an explicit --scope destination.');
  }
  return options;
}

function questionWithCancellation(terminal, prompt) {
  return new Promise((resolve, reject) => {
    let settled = false;
    const finish = callback => value => {
      if (settled) return;

View on GitHub (pinned to 8321021c54)