{"record":{"id":"8edef318b699646a","repo":"Humanizr/Humanizer","slug":"inflection-rule-id-has-unsupported-direction","errorCode":null,"errorMessage":"Inflection rule '{id}' has unsupported direction '{direction}'.","messagePattern":"Inflection rule '(.+?)' has unsupported direction '(.+?)'\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Humanizer.SourceGenerators/Generators/ProfileCatalogs/InflectionCatalogParsing.cs","lineNumber":441,"sourceCode":"                    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))\n                {\n                    throw new InvalidOperationException($\"Duplicate inflection rule id '{id}'.\");\n                }\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\",","sourceCodeStart":423,"sourceCodeEnd":459,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer.SourceGenerators/Generators/ProfileCatalogs/InflectionCatalogParsing.cs#L423-L459","documentation":"A rule's 'direction' must be either 'forward' (singular to plural) or 'reverse' (plural to singular). ParseRules throws for any other value.","triggerScenarios":"'direction:' is anything other than 'forward' or 'reverse' (e.g. 'forwards', 'bidirectional', a typo).","commonSituations":"Typo; trying to express a bidirectional rule with one value instead of splitting into separate forward/reverse rules.","solutions":["Set 'direction: 'forward'' or 'direction: 'reverse''","Split a bidirectional behavior into two rules, one forward and one reverse"],"exampleFix":"# before\n        direction: 'forwards'\n# after\n        direction: 'forward'","handlingStrategy":"validation","validationCode":"foreach (var rule in rules)\n    if (rule.Direction is not \"forward\" and not \"reverse\")\n        Report($\"{locale}: rule '{rule.Id}' direction must be 'forward' or 'reverse'.\");","typeGuard":"static bool DirectionValid(string d) => d is \"forward\" or \"reverse\";","tryCatchPattern":null,"preventionTips":["Split bidirectional behavior into separate forward and reverse 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"}