Humanizr/Humanizer · error · InvalidOperationException

Case overlay '{path}' must explicitly define numeric multipl

Error message

Case overlay '{path}' must explicitly define numeric multiple forms.

What it means

Thrown by ValidateReachableMultipleForms when a phrase value (either in a duration-case realization or in the citation base-duration surface) has no 'multiple' key at all. The validator first checks that a 'multiple' entry exists before proceeding to inspect individual plural forms.

Source

Thrown at src/Humanizer.SourceGenerators/Common/DurationCaseModels.cs:854

                "arabic-cardinal" => ["default", "zero", "dual", "plural", "many"],
                "between2-and4-paucal" or "polish" => ["default", "paucal"],
                "south-slavic" or "russian" =>
                    ["default", "singular", "paucal"],
                "slovenian" => ["default", "dual", "paucal"],
                "lithuanian" => ["default", "singular", "plural"],
                _ => throw new InvalidOperationException(
                    $"Duration case phrases use unsupported plural rule '{pluralRule}'.")
            };

        static void ValidateReachableMultipleForms(
            SimpleYamlValue phraseValue,
            string path,
            ImmutableArray<string> requiredMultipleForms)
        {
            var phrase = ExpectMapping(phraseValue, path);
            if (!phrase.TryGetValue("multiple", out var multipleValue))
            {
                throw new InvalidOperationException(
                    $"Case overlay '{path}' must explicitly define numeric multiple forms.");
            }

            if (requiredMultipleForms.IsEmpty)
            {
                return;
            }

            var multiple = ExpectMapping(multipleValue, $"{path}.multiple");
            var hasScalarDefault = false;
            SimpleYamlMapping? forms = null;
            if (multiple.TryGetValue("forms", out var formsValue))
            {
                hasScalarDefault = formsValue is SimpleYamlScalar;
                forms = formsValue as SimpleYamlMapping;
            }
            else
            {

View on GitHub (pinned to ffc2b77c0f)

Solutions

  1. Add a 'multiple' key to the phrase mapping at the reported path.
  2. Populate it with a 'forms' sub-mapping containing at least the plural forms required by the locale's plural rule (see GetRequiredMultipleForms).
  3. Rebuild to confirm the validator passes.

Example fix

# before
second:
  phrase:
    single: jedna sekunda
# after
second:
  phrase:
    single: jedna sekunda
    multiple:
      forms:
        default: sekund
        paucal: sekundy
Defensive patterns

Strategy: validation

Validate before calling

# Pre-build: ensure every phrase in durationCases has a 'multiple' key
# Use yq or python to walk the YAML tree and flag phrases lacking 'multiple'

Prevention

When it happens

Trigger: A phrase mapping defines only 'single' (or other keys) but omits the 'multiple' key entirely, so TryGetValue('multiple', ...) returns false.

Common situations: A contributor authoring case-aware duration phrases for a locale with a plural rule forgets the 'multiple' sub-mapping, or assumes the generator will inherit a default multiple form from the base phrases.duration surface.

Related errors


AI-assisted analysis of Humanizr/Humanizer@ffc2b77c0f (2026-08-13). Data as JSON: /api/errors/86b55cd4b51364df. Report an issue: GitHub.