affaan-m/ECC · error · Error

Invalid --action value

Error message

Invalid --action value

What it means

Thrown by scripts/welcome.js after parsing when the --action value is not a member of the VALID_ACTIONS set: installed, updated, configured, migrated, resumed, or already-migrated. These are the only lifecycle events for which a welcome banner exists. The check runs post-parse so that a missing --action (which defaults to 'installed') never trips it — only an explicitly supplied unknown value does.

Source

Thrown at scripts/welcome.js:44

      if (!value || value.startsWith('--')) {
        throw new Error('Missing value for --action');
      }
      action = value;
      index += 1;
    } else if (argument === '--version') {
      const value = argv[index + 1];
      if (!value || value.startsWith('--')) {
        throw new Error('Missing value for --version');
      }
      version = value;
      index += 1;
    } else {
      throw new Error('Unknown argument');
    }
  }

  if (!VALID_ACTIONS.has(action)) {
    throw new Error('Invalid --action value');
  }
  if (version !== undefined && !ECC_VERSION_PATTERN.test(version)) {
    throw new Error('Invalid --version value');
  }
  return { action, version };
}

function main(argv = process.argv.slice(2)) {
  try {
    const { action, version } = parseArgs(argv);
    const color = process.env.NO_COLOR === undefined
      && process.env.TERM !== 'dumb'
      && Boolean(process.stdout.isTTY);
    process.stdout.write(renderTerminalWelcome({ action, color, version }));
  } catch (error) {
    process.stderr.write(`Error: ${error.message}\n`);
    process.exitCode = 1;
  }

View on GitHub (pinned to 01e15490f0)

Solutions

  1. Use one of the six canonical values: installed, updated, configured, migrated, resumed, already-migrated.
  2. If the lifecycle event you want is not listed, either omit --action (defaults to 'installed') or extend the VALID_ACTIONS set and add a matching banner.
  3. Audit the install/update hooks that invoke welcome.js to ensure they pass a canonical action.

Example fix

// before
node scripts/welcome.js --action upgraded

// after
node scripts/welcome.js --action updated
Defensive patterns

Strategy: type-guard

Validate before calling

const VALID_ACTIONS = new Set(['installed','updated','configured','migrated','resumed','already-migrated']);
function buildWelcomeArgs(action, version) {
  const args = [];
  if (action && VALID_ACTIONS.has(action)) {
    args.push('--action', action);
  } else if (action) {
    throw new Error(`Unknown welcome action: ${action}. Valid: ${[...VALID_ACTIONS].join(', ')}`);
  }
  if (version) args.push('--version', version);
  return args;
}

Type guard

function isValidAction(value) {
  return typeof value === 'string'
    && ['installed','updated','configured','migrated','resumed','already-migrated'].includes(value);
}

Prevention

When it happens

Trigger: `node scripts/welcome.js --action upgraded` (not in set); `--action install` (close but the valid value is 'installed'); `--action removed` (no banner for removal).

Common situations: Install hooks using a free-form action string that drifted from the canonical set; a refactor that renamed an action (e.g. 'migrate' -> 'migrated') without updating callers; guessing an action name instead of consulting the set.

Related errors


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