affaan-m/ECC · error

Missing value for --locale

Error message

Missing value for --locale

What it means

parseInstallArgs validates CLI arguments in lockstep. When it sees `--locale`, it expects a following token that is a non-empty value not starting with `--`. If the next argument is missing, empty, or is another flag (e.g. `--locale --json`), it throws 'Missing value for --locale'.

Solutions

  1. Pass the locale value right after the flag: `--locale zh-CN`.
  2. Quote the value if it contains special characters: `--locale "pt-BR"`.
  3. Check shell line continuations — ensure the value isn't separated onto a broken line.
  4. Run with `--help` to see the expected flag/value syntax.

Example fix

// before
install --target claude --locale --json

// after
install --target claude --locale zh-CN --json
Defensive patterns

Strategy: validation

Validate before calling

const i = argv.indexOf('--locale');
if (i !== -1) {
  const v = argv[i + 1];
  if (!v || v.startsWith('--')) throw new Error('--locale requires a value, e.g. --locale zh-CN');
}

Type guard

null

Try / catch

try {
  const request = parseInstallArgs(process.argv.slice(2));
} catch (e) {
  if (e.message === 'Missing value for --locale') {
    console.error('Usage: install --locale <supported-locale>');
    process.exitCode = 2;
    return;
  }
  throw e;
}

Prevention

When it happens

Trigger: Running the installer with `--locale` as the last argument, `--locale` followed by nothing (`args[index+1]` is undefined → ''), or `--locale` immediately followed by another `--flag`.

Common situations: Truncating a command in a script (`--locale` with the value on the next line); shell quoting mistakes dropping the value; copy-pasting a flag list where the locale value was lost; forgetting that locale codes like `zh-CN` must not be confused with flags.

Understand the failure class

Background: "no subcommand specified" and "... is required": CLI errors when a required argument is missing — this error's family across 13 libraries.

Related errors


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

Appendix: source

Thrown at scripts/lib/install/request.js:70

    } else if (arg === '--with') {
      const componentId = args[index + 1] || '';
      if (componentId.trim()) {
        parsed.includeComponentIds.push(componentId.trim());
      }
      index += 1;
    } else if (arg === '--skill' || arg === '--skills') {
      parsed.includeComponentIds.push(...normalizeSkillComponentIds(args[index + 1] || ''));
      index += 1;
    } else if (arg === '--without') {
      const componentId = args[index + 1] || '';
      if (componentId.trim()) {
        parsed.excludeComponentIds.push(componentId.trim());
      }
      index += 1;
    } else if (arg === '--locale') {
      const locale = args[index + 1] || '';
      if (!locale || locale.startsWith('--')) {
        throw new Error('Missing value for --locale');
      }
      parsed.locale = locale;
      index += 1;
    } else if (arg === '--enable-hooks') {
      parsed.enableHooks = true;
    } else if (arg === '--no-hooks') {
      parsed.noHooks = true;
    } else if (arg === '--dry-run') {
      parsed.dryRun = true;
    } else if (arg === '--json') {
      parsed.json = true;
    } else if (arg === '--help' || arg === '-h') {
      parsed.help = true;
    } else if (arg.startsWith('--')) {
      throw new Error(`Unknown argument: ${arg}`);
    } else {
      parsed.languages.push(arg);
    }

View on GitHub (pinned to 8321021c54)