{"record":{"id":"f35b7e4c1080ea50","repo":"Humanizr/Humanizer","slug":"inflection-quantityselector-exact-numeric-singlet-f35b7e","errorCode":null,"errorMessage":"Inflection quantitySelector 'exact-numeric-singleton' cannot select productive rule display.","messagePattern":"Inflection quantitySelector 'exact-numeric-singleton' cannot select productive rule display\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Humanizer.SourceGenerators/Generators/ProfileCatalogs/InflectionCatalogParsing.cs","lineNumber":185,"sourceCode":"            SimpleYamlMapping mapping,\n            string cardinalRule,\n            string? quantitySelector,\n            ImmutableArray<InflectionLexemeInput> lexemes,\n            ImmutableArray<InflectionRuleInput> rules)\n        {\n            var hasOptedLexeme = lexemes.Any(static lexeme =>\n                lexeme.Display.ContainsKey(\"one\"));\n            if (quantitySelector is not null)\n            {\n                if (!hasOptedLexeme)\n                {\n                    throw new InvalidOperationException(\n                        \"Inflection quantitySelector 'exact-numeric-singleton' requires at least one lexeme with an authored 'one' display.\");\n                }\n\n                if (rules.Any(static rule => rule.Display.ContainsKey(\"one\")))\n                {\n                    throw new InvalidOperationException(\n                        \"Inflection quantitySelector 'exact-numeric-singleton' cannot select productive rule display.\");\n                }\n\n                return;\n            }\n\n            if (!IsCategoryReachable(mapping, cardinalRule, \"one\") &&\n                (hasOptedLexeme ||\n                 rules.Any(static rule => rule.Display.ContainsKey(\"one\"))))\n            {\n                throw new InvalidOperationException(\n                    \"Inflection display category 'one' is unreachable without quantitySelector 'exact-numeric-singleton'.\");\n            }\n        }\n\n        static bool IsCategoryReachable(\n            SimpleYamlMapping mapping,\n            string cardinalRule,","sourceCodeStart":167,"sourceCodeEnd":203,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer.SourceGenerators/Generators/ProfileCatalogs/InflectionCatalogParsing.cs#L167-L203","documentation":"The 'exact-numeric-singleton' selector may only select a lexeme's authored 'one' display. Productive (stem-template) rules must not define a 'one' output, because the singleton path bypasses rule application for quantity 1. ValidateQuantitySelector throws when any rule has a 'display.one' entry while the selector is active.","triggerScenarios":"quantitySelector is set AND a rule under 'rules:' defines 'output.display.one' as a stem template (e.g. 'one: {stem}y').","commonSituations":"Copying the ProductiveInflectionFixture (which authors both 'one' and 'other' rule outputs) and enabling the selector without dropping the rule's 'one' output.","solutions":["Remove the 'one:' key from each rule's 'output.display', keeping only categories the rule should produce (typically 'other')","Drop the quantitySelector and let productive rules produce 'one' instead"],"exampleFix":"# before (rule output)\n        output:\n          dictionary-plural: '{stem}ies'\n          display:\n            one: '{stem}y'\n            other: '{stem}ies'\n# after\n        output:\n          dictionary-plural: '{stem}ies'\n          display:\n            other: '{stem}ies'","handlingStrategy":"validation","validationCode":"// Reject rule display.one while the singleton selector is active:\nif (selectorSet && rules.Any(r => r.Output.Display.ContainsKey(\"one\")))\n    Report($\"{locale}: rules must not define display.one with the singleton selector.\");","typeGuard":"static bool RulesHaveNoProductiveOne(bool selectorSet, IEnumerable<Rule> rules) =>\n    !selectorSet || rules.All(r => !r.Display.ContainsKey(\"one\"));","tryCatchPattern":null,"preventionTips":["Productive rules under the singleton selector should only author 'other' (and other non-one categories)","Diff against ProductiveInflectionFixture when adapting rules"],"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"}