{"record":{"id":"531682307aad07c6","repo":"Humanizr/Humanizer","slug":"inflection-display-category-one-is-unreachable-w","errorCode":null,"errorMessage":"Inflection display category 'one' is unreachable without quantitySelector 'exact-numeric-singleton'.","messagePattern":"Inflection display category 'one' is unreachable without quantitySelector 'exact-numeric-singleton'\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Humanizer.SourceGenerators/Generators/ProfileCatalogs/InflectionCatalogParsing.cs","lineNumber":196,"sourceCode":"                {\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,\n            string category)\n        {\n            if (ReachableCategories(cardinalRule).Contains(category, StringComparer.Ordinal))\n            {\n                return true;\n            }\n\n            return mapping.TryGetValue(\"regionalRules\", out var regionalRulesValue) &&\n                regionalRulesValue is SimpleYamlMapping regionalRules &&\n                regionalRules.Values.Any(entry =>\n                    entry.Value is SimpleYamlScalar rule &&","sourceCodeStart":178,"sourceCodeEnd":214,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer.SourceGenerators/Generators/ProfileCatalogs/InflectionCatalogParsing.cs#L178-L214","documentation":"For cardinal rules whose reachable categories do not include 'one' (e.g. 'Other'), authoring a 'one' display on a lexeme or rule without 'quantitySelector: exact-numeric-singleton' produces output that can never be selected. IsCategoryReachable returns false and ValidateQuantitySelector rejects the dead category.","triggerScenarios":"cardinalRule's reachable set excludes 'one', no 'regionalRules' entry reaches 'one', quantitySelector is absent, yet a lexeme or rule defines a 'one' display.","commonSituations":"Enabling a 'one' display form on a locale whose cardinalRule is 'Other' but forgetting the quantitySelector; refactoring cardinalRule away from a rule that reaches 'one' (e.g. 'EnglishLike') without revisiting display categories.","solutions":["Add 'quantitySelector: exact-numeric-singleton' (and satisfy its preconditions: capability 'display-by-category', cardinalRule 'Other', an authored lexeme 'one')","Remove the 'one' display entries from lexemes and rules","Add a 'regionalRules' entry whose cardinal rule reaches 'one'"],"exampleFix":"# before (cardinalRule 'Other', no selector, has display.one)\n    cardinalRule: 'Other'\n    capability: 'display-by-category'\n# after\n    cardinalRule: 'Other'\n    capability: 'display-by-category'\n    quantitySelector: 'exact-numeric-singleton'","handlingStrategy":"validation","validationCode":"// 'one' is reachable only via cardinalRule/regionalRules or the selector:\nbool reachable = IsCategoryReachable(m, cardinalRule, \"one\");\nbool hasOne = lexemes.Any(l => l.Display.ContainsKey(\"one\")) ||\n              rules.Any(r => r.Display.ContainsKey(\"one\"));\nif (!reachable && hasOne && !selectorSet)\n    Report($\"{locale}: 'one' is unreachable; add quantitySelector or remove 'one' displays.\");","typeGuard":"static bool OneIsJustified(bool reachable, bool hasOne, bool selectorSet) =>\n    !hasOne || reachable || selectorSet;","tryCatchPattern":null,"preventionTips":["Map your cardinalRule to its reachable CLDR categories before authoring display keys","If you switch cardinalRule away from one that reaches 'one', re-audit display blocks"],"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"}