affaan-m/ECC · error

Unknown legacy languages

Error message

Unknown legacy languages: ${unknownLegacyLanguages.join(', ')}. Expected one of ${listLegacyCompatibilityLanguages().join(', ')}

What it means

Same validation as the single-unknown-language case, but when two or more unrecognized languages are supplied, the function aggregates them into one error listing all offending values and the accepted set. Fail-fast on the whole batch rather than one at a time.

Solutions

  1. Fix every listed language against the accepted values from listLegacyCompatibilityLanguages()
  2. Diff your language list against LEGACY_LANGUAGE_ALIAS_TO_CANONICAL keys before calling
  3. Log/validate the full list up front so all mistakes are surfaced at once

Example fix

// before
resolveLegacyCompatibilitySelection({ legacyLanguages: ['pythn', 'rubyy'] })
// after
resolveLegacyCompatibilitySelection({ legacyLanguages: ['python', 'ruby'] })
Defensive patterns

Strategy: validation

Validate before calling

const accepted = new Set(Object.keys(LEGACY_LANGUAGE_ALIAS_TO_CANONICAL));
const bad = options.legacyLanguages.filter(l => !accepted.has(String(l).toLowerCase()));
if (bad.length > 1) throw new Error(`unknown legacy languages: ${bad.join(', ')}`);

Type guard

function areKnownLegacyLanguages(list) {
  return Array.isArray(list) && list.every(l => typeof l === 'string' && Object.hasOwn(LEGACY_LANGUAGE_ALIAS_TO_CANONICAL, l.toLowerCase()));
}

Try / catch

try {
  const sel = resolveLegacyCompatibilitySelection(options);
} catch (err) {
  if (err.message.startsWith('Unknown legacy languages:')) {
    console.error(`${err.message}`); process.exitCode = 2;
  } else throw err;
}

Prevention

When it happens

Trigger: resolveLegacyCompatibilitySelection({ legacyLanguages: ['pythn', 'rubyy'] }) — two or more strings absent from LEGACY_LANGUAGE_ALIAS_TO_CANONICAL.

Common situations: Bulk-pasting a language list from an old config, migrating scripts from a tool with different language names, or scripted generation of flag values.

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/9cbe4515a5c0694b. Report an issue: GitHub.

Appendix: source

Thrown at scripts/lib/install-manifests.js:516

  const legacyLanguages = dedupeStrings(options.legacyLanguages)
    .map(language => language.toLowerCase());
  const normalizedLegacyLanguages = dedupeStrings(legacyLanguages);

  if (normalizedLegacyLanguages.length === 0) {
    throw new Error('No legacy languages were provided');
  }

  const unknownLegacyLanguages = normalizedLegacyLanguages
    .filter(language => !Object.hasOwn(LEGACY_LANGUAGE_ALIAS_TO_CANONICAL, language));

  if (unknownLegacyLanguages.length === 1) {
    throw new Error(
      `Unknown legacy language: ${unknownLegacyLanguages[0]}. Expected one of ${listLegacyCompatibilityLanguages().join(', ')}`
    );
  }

  if (unknownLegacyLanguages.length > 1) {
    throw new Error(
      `Unknown legacy languages: ${unknownLegacyLanguages.join(', ')}. Expected one of ${listLegacyCompatibilityLanguages().join(', ')}`
    );
  }

  const canonicalLegacyLanguages = normalizedLegacyLanguages
    .map(language => LEGACY_LANGUAGE_ALIAS_TO_CANONICAL[language]);
  const ruleLanguages = normalizedLegacyLanguages.map(language => (
    LEGACY_LANGUAGE_RULE_NAMESPACES[language] || language
  ));
  const baseModuleIds = LEGACY_COMPAT_BASE_MODULE_IDS_BY_TARGET[target || 'claude']
    || LEGACY_COMPAT_BASE_MODULE_IDS_BY_TARGET.claude;
  const moduleIds = dedupeStrings([
    ...baseModuleIds,
    ...(target === 'antigravity'
      ? []
      : canonicalLegacyLanguages.flatMap(language => LEGACY_LANGUAGE_EXTRA_MODULE_IDS[language] || [])),
  ]);

View on GitHub (pinned to 8321021c54)