{"record":{"id":"6a4239a76c9ef094","repo":"Humanizr/Humanizer","slug":"inflection-rule-id-scope-uses-a-script-not-dec","errorCode":null,"errorMessage":"Inflection rule '{id}' scope uses a script not declared by its owner.","messagePattern":"Inflection rule '(.+?)' scope uses a script not declared by its owner\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Humanizer.SourceGenerators/Generators/ProfileCatalogs/InflectionCatalogParsing.cs","lineNumber":475,"sourceCode":"                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\",\n                    $\"Inflection rule '{id}' scope must define scripts\");\n                if (ruleScripts.Any(script => !ownerScripts.Contains(script, StringComparer.Ordinal)))\n                {\n                    throw new InvalidOperationException(\n                        $\"Inflection rule '{id}' scope uses a script not declared by its owner.\");\n                }\n\n                var match = GetRequiredMapping(rule, \"match\", $\"Inflection rule '{id}' must define match\");\n                ValidateProperties(\n                    match,\n                    $\"Inflection rule '{id}' match\",\n                    \"prefix\", \"suffix\", \"precedingNot\", \"preceding-not\");\n                var prefix = NormalizeAuthoredText(\n                    match.GetScalar(\"prefix\") ?? string.Empty,\n                    casing,\n                    ruleScripts,\n                    $\"rule '{id}' prefix\",\n                    allowStemPlaceholder: false,\n                    allowNonLetters: false);\n                var suffix = NormalizeAuthoredText(\n                    match.GetScalar(\"suffix\") ?? string.Empty,\n                    casing,","sourceCodeStart":457,"sourceCodeEnd":493,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer.SourceGenerators/Generators/ProfileCatalogs/InflectionCatalogParsing.cs#L457-L493","documentation":"A rule's 'scope.scripts' entries must all appear in the bundle's top-level 'scripts:' list. ParseRules throws when a rule references a Unicode script the owner has not declared, because a rule cannot operate on a script its bundle does not own.","triggerScenarios":"A rule scope lists e.g. 'Cyrl' while the bundle's top-level 'scripts:' only declares 'Latn'.","commonSituations":"Adding a script-specific rule without adding the script to the owner declaration; authoring a multi-script locale and scoping rules narrowly.","solutions":["Add the script to the top-level 'scripts:' list of the inflection bundle","Remove the script from the rule's 'scope.scripts'"],"exampleFix":"# before\n    scripts:\n      - 'Latn'\n    rules:\n      - id: 'zz.forward.consonant-y'\n        scope:\n          scripts:\n            - 'Cyrl'\n# after\n    scripts:\n      - 'Latn'\n      - 'Cyrl'\n","handlingStrategy":"validation","validationCode":"var ownerScripts = GetRequiredStrings(m, \"scripts\");\nforeach (var rule in rules)\nforeach (var s in rule.Scope.Scripts)\n    if (!ownerScripts.Contains(s, StringComparer.Ordinal))\n        Report($\"{locale}: rule '{rule.Id}' script '{s}' not declared by owner.\");","typeGuard":"static bool RuleScriptsDeclaredByOwner(\n    ImmutableArray<string> ownerScripts, IEnumerable<string> ruleScripts) =>\n    ruleScripts.All(s => ownerScripts.Contains(s, StringComparer.Ordinal));","tryCatchPattern":null,"preventionTips":["When scoping a rule to a new script, add that script to the bundle 'scripts:' list first","For multi-script locales, declare the full script set at the owner level"],"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"}