{"record":{"id":"4d48e5c76e909cd6","repo":"Humanizr/Humanizer","slug":"active-inflection-bundle-must-define-lexemes","errorCode":null,"errorMessage":"Active inflection bundle must define lexemes.","messagePattern":"Active inflection bundle must define lexemes\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Humanizer.SourceGenerators/Generators/ProfileCatalogs/InflectionCatalogParsing.cs","lineNumber":230,"sourceCode":"                regionalRulesValue is SimpleYamlMapping regionalRules &&\n                regionalRules.Values.Any(entry =>\n                    entry.Value is SimpleYamlScalar rule &&\n                    CardinalRules.Contains(rule.Value) &&\n                    ReachableCategories(rule.Value).Contains(category, StringComparer.Ordinal));\n        }\n\n        static ImmutableArray<InflectionLexemeInput> ParseLexemes(\n            SimpleYamlMapping mapping,\n            string cardinalRule,\n            ImmutableHashSet<string> sourceIds,\n            ImmutableArray<string> ownerScripts,\n            string casing,\n            bool allowEmpty)\n        {\n            if (!mapping.TryGetValue(\"lexemes\", out var lexemeValue) ||\n                lexemeValue is not SimpleYamlSequence lexemeSequence)\n            {\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                }","sourceCodeStart":212,"sourceCodeEnd":248,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer.SourceGenerators/Generators/ProfileCatalogs/InflectionCatalogParsing.cs#L212-L248","documentation":"A 'display-by-category' capability bundle must contain a 'lexemes' block sequence. ParseLexemes throws when the key is absent or when its value is not a YAML sequence. This is the missing-or-wrong-type branch (distinct from the empty-sequence branch).","triggerScenarios":"'surfaces.inflection' has 'capability: display-by-category' but no 'lexemes:' key, or 'lexemes:' is a scalar or mapping instead of a list.","commonSituations":"Starting a new active locale from the invariant fixture (which declares 'lexemes: []') and forgetting to add the key; a YAML indentation slip turning the sequence into a mapping.","solutions":["Add a 'lexemes:' block sequence with at least one lexeme mapping","If the locale is intentionally empty, use 'capability: invariant'"],"exampleFix":"# before\n  inflection:\n    capability: 'display-by-category'\n    # no lexemes key\n# after\n  inflection:\n    capability: 'display-by-category'\n    lexemes:\n      - id: 'zz.noun.cat'\n        pos: 'noun'\n        countability: 'count'\n        forms:\n          singular:\n            preferred: 'cat'\n            accepted:\n              - 'cat'\n          dictionary-plural:\n            preferred: 'cats'\n            accepted:\n              - 'cats'\n          display:\n            one:\n              preferred: 'cat'\n              accepted:\n                - 'cat'\n            other:\n              preferred: 'cats'\n              accepted:\n                - 'cats'\n        sources:\n          - 'fixture'","handlingStrategy":"validation","validationCode":"// Active (non-invariant) bundles require a lexemes block sequence:\nif (capability == \"display-by-category\" &&\n    (!m.TryGetValue(\"lexemes\", out var lv) || lv is not SimpleYamlSequence))\n    Report($\"{locale}: display-by-category requires a 'lexemes' block sequence.\");","typeGuard":"static bool HasLexemesSequence(SimpleYamlMapping m) =>\n    m.TryGetValue(\"lexemes\", out var v) && v is SimpleYamlSequence;","tryCatchPattern":null,"preventionTips":["Use 'capability: invariant' with 'lexemes: []' until real data exists","Start active locales from CompleteInflectionFixtureFor"],"tags":["inflection","localization","yaml","source-generator","locale","validation"],"backgroundTag":null,"analyzedSha":"ffc2b77c0f30d2fb176875841424379319d0ae9b","analyzedAt":"2026-08-13T21:42:34.584Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}