{"record":{"id":"bba0101084da0e4b","repo":"Humanizr/Humanizer","slug":"inflection-lexemes-must-be-mappings","errorCode":null,"errorMessage":"Inflection lexemes must be mappings.","messagePattern":"Inflection lexemes must be mappings\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Humanizer.SourceGenerators/Generators/ProfileCatalogs/InflectionCatalogParsing.cs","lineNumber":247,"sourceCode":"            {\n                throw new InvalidOperationException(\"Active inflection bundle must define lexemes.\");\n            }\n\n            if (lexemeSequence.Items.IsEmpty)\n            {\n                return allowEmpty\n                    ? []\n                    : throw new InvalidOperationException(\n                        \"Active inflection bundle must define lexemes.\");\n            }\n\n            var ids = new HashSet<string>(StringComparer.Ordinal);\n            var lexemes = ImmutableArray.CreateBuilder<InflectionLexemeInput>();\n            foreach (var value in lexemeSequence.Items)\n            {\n                if (value is not SimpleYamlMapping lexeme)\n                {\n                    throw new InvalidOperationException(\"Inflection lexemes must be mappings.\");\n                }\n\n                ValidateProperties(\n                    lexeme,\n                    \"Inflection lexeme\",\n                    \"id\", \"pos\", \"countability\", \"sense\", \"forms\", \"sources\");\n                var id = GetRequiredScalar(lexeme, \"id\", \"Inflection lexeme must define id\");\n                if (!ids.Add(id))\n                {\n                    throw new InvalidOperationException($\"Duplicate inflection lexeme id '{id}'.\");\n                }\n\n                if (GetRequiredScalar(lexeme, \"pos\", $\"Inflection lexeme '{id}' must define pos\") != \"noun\")\n                {\n                    throw new InvalidOperationException($\"Inflection lexeme '{id}' pos must be 'noun'.\");\n                }\n\n                var countability = GetRequiredScalar(","sourceCodeStart":229,"sourceCodeEnd":265,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer.SourceGenerators/Generators/ProfileCatalogs/InflectionCatalogParsing.cs#L229-L265","documentation":"Each item in the 'lexemes:' sequence must itself be a YAML mapping (an object with keys like id, pos, countability, forms, sources). ParseLexemes throws when a list item is a scalar, null, or nested sequence instead of a mapping.","triggerScenarios":"An item under 'lexemes:' is a bare string/number or a nested sequence rather than a mapping.","commonSituations":"A YAML indentation slip flattening '- id: ...' into a flat list of scalars; pasting a list of ids instead of full lexeme objects.","solutions":["Make each list item a mapping containing id, pos, countability, forms, and sources"],"exampleFix":"# before\n    lexemes:\n      - 'zz.noun.cat'\n      - 'zz.noun.dog'\n# after\n    lexemes:\n      - id: 'zz.noun.cat'\n        pos: 'noun'\n        countability: 'count'\n        forms: { ... }\n        sources: [ 'fixture' ]","handlingStrategy":"validation","validationCode":"foreach (var item in lexemeSequence.Items)\n    if (item is not SimpleYamlMapping)\n        Report($\"{locale}: each lexemes entry must be a mapping.\");","typeGuard":"static bool AllLexemesAreMappings(SimpleYamlSequence s) =>\n    s.Items.All(i => i is SimpleYamlMapping);","tryCatchPattern":null,"preventionTips":["Validate YAML structure with an editor schema; each '- ' item must hold key: value pairs"],"tags":["inflection","localization","yaml","source-generator","locale","validation"],"backgroundTag":null,"analyzedSha":"ffc2b77c0f30d2fb176875841424379319d0ae9b","analyzedAt":"2026-08-13T21:42:34.584Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}