{"record":{"id":"44b5eaf8090d11f6","repo":"Humanizr/Humanizer","slug":"path-must-define-classification","errorCode":null,"errorMessage":"'{path}' must define 'classification'.","messagePattern":"'(.+?)' must define 'classification'\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Humanizer.SourceGenerators/Common/DurationCaseModels.cs","lineNumber":332,"sourceCode":"        }\n\n        static DurationCaseCatalog ParseLegacyForTests(\n            string localeCode,\n            SimpleYamlMapping mapping,\n            string path)\n        {\n            RejectUnknownKeys(mapping, path, [\"classification\", \"cases\"]);\n\n            var classification = mapping.GetScalar(\"classification\") switch\n            {\n                \"distinct\" => DurationCaseClassification.Distinct,\n                \"same-as-nominative\" => DurationCaseClassification.Invariant,\n                \"not-applicable\" => DurationCaseClassification.NotApplicable,\n                \"unsupported\" => DurationCaseClassification.Unsupported,\n                { } unsupported => throw new InvalidOperationException(\n                    $\"'{path}.classification' has unsupported value '{unsupported}'. \" +\n                    \"Supported values: distinct, same-as-nominative, not-applicable, unsupported.\"),\n                null => throw new InvalidOperationException($\"'{path}' must define 'classification'.\")\n            };\n\n            if (classification != DurationCaseClassification.Distinct)\n            {\n                if (mapping.TryGetValue(\"cases\", out _))\n                {\n                    throw new InvalidOperationException(\n                        $\"'{path}.cases' is only valid when classification is 'distinct'.\");\n                }\n\n                return new DurationCaseCatalog(\n                    localeCode,\n                    classification,\n                    \"nominative\",\n                    classification == DurationCaseClassification.Invariant ? [\"nominative\"] : [],\n                    EmptyRealizations(),\n                    EmptySources(),\n                    classification == DurationCaseClassification.Invariant","sourceCodeStart":314,"sourceCodeEnd":350,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer.SourceGenerators/Common/DurationCaseModels.cs#L314-L350","documentation":"Thrown by ParseLegacyForTests when the durationCases mapping has no 'classification' key at all (GetScalar returns null). Every durationCases block — legacy or explicit — must declare how the locale handles grammatical case for duration units.","triggerScenarios":"ParseLegacyForTests's switch expression hits the null pattern when mapping.GetScalar('classification') returns null. For example 'durationCases:\\n  cases:\\n    genitive: ...' without a classification line.","commonSituations":"A contributor writes a durationCases block with cases but forgets the classification header. Or the classification line is indented incorrectly so YAML parses it as a child of another key rather than a top-level scalar of durationCases.","solutions":["Add a 'classification' scalar to the durationCases mapping (e.g. 'classification: distinct').","Verify YAML indentation — the classification key must be a direct child of durationCases, not nested deeper.","Use a known-good locale file as a template to confirm the expected key structure."],"exampleFix":"# before (missing classification)\ndurationCases:\n  cases:\n    genitive: { ... }\n# after\ndurationCases:\n  classification: distinct\n  cases:\n    genitive: { ... }","handlingStrategy":"validation","validationCode":"// Ensure durationCases has a classification scalar\nstatic bool HasClassification(SimpleYamlMapping durationCases) =>\n    durationCases.GetScalar(\"classification\") is not null;","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Every durationCases block must start with a classification line.","Verify YAML indentation — classification must be a direct child of durationCases.","Use a YAML linter or editor with schema support to catch missing required keys."],"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-14T00:17:13.853Z"}