{"record":{"id":"e9bb2a98ce17abc8","repo":"Humanizr/Humanizer","slug":"inflection-rules-must-be-a-block-sequence","errorCode":null,"errorMessage":"Inflection rules must be a block sequence.","messagePattern":"Inflection rules must be a block sequence\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Humanizer.SourceGenerators/Generators/ProfileCatalogs/InflectionCatalogParsing.cs","lineNumber":414,"sourceCode":"            return new(preferred, accepted);\n        }\n\n        static ImmutableArray<InflectionRuleInput> ParseRules(\n            SimpleYamlMapping mapping,\n            ImmutableHashSet<string> sourceIds,\n            ImmutableHashSet<string> lexemeIds,\n            ImmutableArray<string> ownerScripts,\n            string cardinalRule,\n            string casing)\n        {\n            if (!mapping.TryGetValue(\"rules\", out var value))\n            {\n                return [];\n            }\n\n            if (value is not SimpleYamlSequence sequence)\n            {\n                throw new InvalidOperationException(\"Inflection rules must be a block sequence.\");\n            }\n\n            var rules = ImmutableArray.CreateBuilder<InflectionRuleInput>();\n            var ids = new HashSet<string>(StringComparer.Ordinal);\n            foreach (var item in sequence.Items)\n            {\n                if (item is not SimpleYamlMapping rule)\n                {\n                    throw new InvalidOperationException(\"Inflection rules must be mappings.\");\n                }\n\n                ValidateProperties(\n                    rule,\n                    \"Inflection rule\",\n                    \"id\", \"direction\", \"priority\", \"scope\", \"match\", \"output\",\n                    \"hostileExclusions\", \"hostile-exclusions\", \"reverse\", \"sources\");\n                var id = GetRequiredScalar(rule, \"id\", \"Inflection rule must define id\");\n                if (!ids.Add(id))","sourceCodeStart":396,"sourceCodeEnd":432,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer.SourceGenerators/Generators/ProfileCatalogs/InflectionCatalogParsing.cs#L396-L432","documentation":"The optional 'rules:' key, when present, must be a YAML block sequence (a list of rule mappings). ParseRules throws when 'rules:' exists but is a scalar or mapping rather than a sequence.","triggerScenarios":"'rules:' is present but is a mapping or scalar rather than a list.","commonSituations":"Indenting rule content as a mapping instead of a sequence; pasting a single rule object directly under 'rules:' without the leading dash.","solutions":["Make 'rules:' a block sequence whose items are mappings","Omit 'rules:' entirely if no productive rules are needed"],"exampleFix":"# before\n    rules:\n      id: 'zz.forward.consonant-y'\n      direction: 'forward'\n# after\n    rules:\n      - id: 'zz.forward.consonant-y'\n        direction: 'forward'\n        ...","handlingStrategy":"validation","validationCode":"if (m.TryGetValue(\"rules\", out var rv) && rv is not SimpleYamlSequence)\n    Report($\"{locale}: 'rules' must be a block sequence.\");","typeGuard":"static bool RulesIsSequence(SimpleYamlMapping m) =>\n    !m.TryGetValue(\"rules\", out var v) || v is SimpleYamlSequence;","tryCatchPattern":null,"preventionTips":["Each rule must start with '- id:'; rules: with no leading dash is a mapping"],"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"}