{"record":{"id":"ad7c28e05c14f4fb","repo":"Humanizr/Humanizer","slug":"distinct-duration-cases-for-localecode-must-de","errorCode":null,"errorMessage":"Distinct duration cases for '{localeCode}' must define 'cases'.","messagePattern":"Distinct duration cases for '(.+?)' must define 'cases'\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Humanizer.SourceGenerators/Common/DurationCaseModels.cs","lineNumber":359,"sourceCode":"                }\n\n                return new DurationCaseCatalog(\n                    localeCode,\n                    classification,\n                    \"nominative\",\n                    classification == DurationCaseClassification.Invariant ? [\"nominative\"] : [],\n                    EmptyRealizations(),\n                    EmptySources(),\n                    classification == DurationCaseClassification.Invariant\n                        ? ImmutableDictionary<string, DurationCaseOverlay>.Empty\n                            .WithComparers(StringComparer.Ordinal)\n                            .Add(\"nominative\", CreateBaseDurationOverlay())\n                        : ImmutableDictionary<string, DurationCaseOverlay>.Empty.WithComparers(StringComparer.Ordinal));\n            }\n\n            if (!mapping.TryGetValue(\"cases\", out var casesValue))\n            {\n                throw new InvalidOperationException($\"Distinct duration cases for '{localeCode}' must define 'cases'.\");\n            }\n\n            var casesMapping = ExpectMapping(casesValue, $\"{path}.cases\");\n            var cases = ImmutableDictionary.CreateBuilder<string, DurationCaseOverlay>(StringComparer.Ordinal);\n            foreach (var caseName in casesMapping.Values.Keys\n                         .OrderBy(static name => name, StringComparer.Ordinal)\n                         .Where(caseName => !Cases.Contains(caseName, StringComparer.Ordinal) || caseName == \"nominative\"))\n            {\n                throw new InvalidOperationException(\n                    $\"'{path}.cases' defines unsupported non-nominative case '{caseName}'.\");\n            }\n\n            foreach (var caseName in Cases\n                         .Where(static caseName => caseName != \"nominative\")\n                         .Where(casesMapping.Values.ContainsKey))\n            {\n                cases[caseName] = ParseCase(casesMapping.Values[caseName], $\"{path}.cases.{caseName}\");\n            }","sourceCodeStart":341,"sourceCodeEnd":377,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer.SourceGenerators/Common/DurationCaseModels.cs#L341-L377","documentation":"Thrown by ParseLegacyForTests when classification is 'distinct' but the durationCases mapping has no 'cases' key. Distinct classification means the locale has different word forms per grammatical case, so at least the case definitions must be provided.","triggerScenarios":"After the non-distinct early return, ParseLegacyForTests calls TryGetValue('cases'). If it returns false, the throw fires. For example 'classification: distinct' with no cases block underneath.","commonSituations":"A contributor sets classification to 'distinct' as a placeholder but hasn't yet authored the case data. Or the cases key is misspelled or indented wrong so the parser doesn't find it.","solutions":["Add a 'cases' mapping with at least one non-nominative case definition (e.g. genitive, dative).","If the locale doesn't actually have distinct cases, change classification to 'same-as-nominative', 'not-applicable', or 'unsupported'.","Verify YAML indentation so 'cases' is a direct child of durationCases."],"exampleFix":"# before (distinct but no cases)\ndurationCases:\n  classification: distinct\n# after\ndurationCases:\n  classification: distinct\n  cases:\n    genitive: { ... }","handlingStrategy":"validation","validationCode":"// Distinct classification requires cases\nstatic bool DistinctHasCases(SimpleYamlMapping durationCases)\n{\n    if (durationCases.GetScalar(\"classification\") != \"distinct\") return true;\n    return durationCases.TryGetValue(\"cases\", out _);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["If classification is 'distinct', always include a 'cases' block with real case data.","Don't set 'distinct' as a placeholder — use 'unsupported' during development instead.","Template new distinct locales from an existing one with complete case data."],"tags":["source-generator","duration-cases","legacy-format","testing","classification"],"backgroundTag":null,"analyzedSha":"ffc2b77c0f30d2fb176875841424379319d0ae9b","analyzedAt":"2026-08-13T21:42:34.584Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}