affaan-m/ECC · error · Error

Missing value for --action

Error message

Missing value for --action

What it means

Thrown by scripts/welcome.js parseArgs when --action is passed but the next argv token is missing or itself starts with '--' (i.e. looks like another flag). The parser explicitly guards `if (!value || value.startsWith('--'))` because naively consuming the next flag as the action value would silently corrupt parsing. --action selects which welcome banner variant to render, so it must be a concrete value.

Source

Thrown at scripts/welcome.js:27

const VALID_ACTIONS = new Set([
  'installed',
  'updated',
  'configured',
  'migrated',
  'resumed',
  'already-migrated',
]);

function parseArgs(argv) {
  let action = 'installed';
  let version;

  for (let index = 0; index < argv.length; index += 1) {
    const argument = argv[index];
    if (argument === '--action') {
      const value = argv[index + 1];
      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');
  }

View on GitHub (pinned to 01e15490f0)

Solutions

  1. Supply one of the valid action values (installed, updated, configured, migrated, resumed, already-migrated) immediately after --action.
  2. If the action is optional, omit --action entirely (it defaults to 'installed').
  3. Ensure the wrapper script interpolates a non-empty, non-flag value for the action.

Example fix

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

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

Strategy: validation

Validate before calling

const VALID_ACTIONS = new Set(['installed','updated','configured','migrated','resumed','already-migrated']);
const action = process.env.ECC_WELCOME_ACTION;
const args = [];
if (action && VALID_ACTIONS.has(action)) {
  args.push('--action', action);
}
// omit --action entirely to let welcome.js default to 'installed'

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` (last token); `node scripts/welcome.js --action --version 2.2.0` (--action immediately followed by another flag).

Common situations: A post-install hook that passes `--action $ACTION` where $ACTION is empty in a particular install path; reordering flags and leaving --action dangling; a template where the action placeholder was never substituted.

Related errors


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