{"record":{"id":"f9ffd5b262cce4fc","repo":"Humanizr/Humanizer","slug":"inflection-rule-id-scope-must-target-standalon","errorCode":null,"errorMessage":"Inflection rule '{id}' scope must target standalone nouns.","messagePattern":"Inflection rule '(.+?)' scope must target standalone nouns\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Humanizer.SourceGenerators/Generators/ProfileCatalogs/InflectionCatalogParsing.cs","lineNumber":453,"sourceCode":"                }\n\n                ValidateSources(rule, sourceIds, $\"Inflection rule '{id}'\");\n                var direction = GetRequiredScalar(rule, \"direction\", $\"Inflection rule '{id}' must define direction\");\n                if (direction is not (\"forward\" or \"reverse\"))\n                {\n                    throw new InvalidOperationException($\"Inflection rule '{id}' has unsupported direction '{direction}'.\");\n                }\n\n                var priority = GetRequiredInt(rule, \"priority\", $\"Inflection rule '{id}' must define priority\");\n                var scope = GetRequiredMapping(rule, \"scope\", $\"Inflection rule '{id}' must define scope\");\n                ValidateProperties(\n                    scope,\n                    $\"Inflection rule '{id}' scope\",\n                    \"pos\", \"countability\", \"token\", \"scripts\");\n                if (GetRequiredScalar(scope, \"pos\", $\"Inflection rule '{id}' scope must define pos\") != \"noun\" ||\n                    GetRequiredScalar(scope, \"token\", $\"Inflection rule '{id}' scope must define token\") != \"standalone\")\n                {\n                    throw new InvalidOperationException(\n                        $\"Inflection rule '{id}' scope must target standalone nouns.\");\n                }\n\n                var countabilities = GetRequiredStrings(\n                    scope,\n                    \"countability\",\n                    $\"Inflection rule '{id}' scope must define countability\");\n                foreach (var countability in countabilities)\n                {\n                    if (!Countabilities.Contains(countability))\n                    {\n                        throw new InvalidOperationException(\n                            $\"Inflection rule '{id}' scope countability '{countability}' is unsupported.\");\n                    }\n                }\n                var ruleScripts = GetRequiredStrings(\n                    scope,\n                    \"scripts\",","sourceCodeStart":435,"sourceCodeEnd":471,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer.SourceGenerators/Generators/ProfileCatalogs/InflectionCatalogParsing.cs#L435-L471","documentation":"A rule's 'scope' must have 'pos: noun' and 'token: standalone'. The engine only applies productive rules to standalone noun tokens. ParseRules throws when either field differs.","triggerScenarios":"scope has 'pos:' other than 'noun', or 'token:' other than 'standalone' (e.g. 'token: phrase').","commonSituations":"Copying a fixture and changing token to 'phrase'; modeling a non-noun rule before the engine supports it.","solutions":["Set 'scope.pos: 'noun'' and 'scope.token: 'standalone''"],"exampleFix":"# before\n        scope:\n          pos: 'noun'\n          token: 'phrase'\n# after\n        scope:\n          pos: 'noun'\n          token: 'standalone'","handlingStrategy":"validation","validationCode":"foreach (var rule in rules)\n    if (rule.Scope.Pos != \"noun\" || rule.Scope.Token != \"standalone\")\n        Report($\"{locale}: rule '{rule.Id}' scope must target standalone nouns.\");","typeGuard":"static bool ScopeIsStandaloneNoun(Scope sc) =>\n    sc.Pos == \"noun\" && sc.Token == \"standalone\";","tryCatchPattern":null,"preventionTips":["Copy scope verbatim from ProductiveInflectionFixture; only vary countability/scripts"],"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"}