{"record":{"id":"c7ed314b49a0b38b","repo":"Humanizr/Humanizer","slug":"feature-featurename-in-locale-localecode-m","errorCode":null,"errorMessage":"Feature '{featureName}' in locale '{localeCode}' must be a scalar or mapping.","messagePattern":"Feature '(.+?)' in locale '(.+?)' must be a scalar or mapping\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Humanizer.SourceGenerators/Common/LocaleYamlCatalog.cs","lineNumber":745,"sourceCode":"        static LocaleFeature? ResolveFeature(\n            string localeCode,\n            string featureName,\n            ImmutableDictionary<string, SimpleYamlValue> features)\n        {\n            return !features.TryGetValue(featureName, out var featureValue)\n                ? null\n                : featureValue switch\n                {\n                    SimpleYamlScalar scalar => new LocaleFeature(\n                        ownerLocaleCode: localeCode,\n                        featureName: featureName,\n                        kind: scalar.Value,\n                        argument: null,\n                        profileName: null,\n                        profileRoot: default,\n                        usesGeneratedProfile: false),\n                    SimpleYamlMapping mapping => CreateMappedFeature(localeCode, featureName, mapping),\n                    _ => throw new InvalidOperationException(\n                        $\"Feature '{featureName}' in locale '{localeCode}' must be a scalar or mapping.\")\n                };\n        }\n\n        static SimpleYamlMapping? ResolveGrammar(\n            string localeCode,\n            ImmutableDictionary<string, SimpleYamlValue> features)\n        {\n            return !features.TryGetValue(\"grammar\", out var grammarValue)\n                ? null\n                : grammarValue as SimpleYamlMapping\n                ?? throw new InvalidOperationException($\"Locale '{localeCode}.grammar' must be a mapping.\");\n        }\n\n        static LocalePhraseCatalog? ResolvePhraseCatalog(\n            string localeCode,\n            ImmutableDictionary<string, SimpleYamlValue> features)\n        {","sourceCodeStart":727,"sourceCodeEnd":763,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer.SourceGenerators/Common/LocaleYamlCatalog.cs#L727-L763","documentation":"Each supported feature key (formatter, ordinalizer, etc.) must resolve to either a YAML scalar (engine name shorthand) or a YAML mapping (full configuration). Any other YAML node type — typically a sequence — is structurally invalid for a feature value and the generator cannot interpret it.","triggerScenarios":"A feature key in a locale YAML file is assigned a YAML sequence (list) value, e.g. 'formatter:\\n  - default'. The feature resolver's switch expression hits the default arm because the value is neither SimpleYamlScalar nor SimpleYamlMapping.","commonSituations":"Accidentally indenting a list under a feature key; copying a headings-style sequence into a scalar/mapping feature slot; YAML indentation drift placing list items under the wrong parent key.","solutions":["Check the feature named in the message and change its value from a sequence to a scalar string or a mapping (key-value pairs).","Compare against a known-good locale file to see the expected shape for that feature name.","Verify YAML indentation — a stray leading '-' can turn a mapping value into a sequence."],"exampleFix":"# before\nformatter:\n  - default\n\n# after\nformatter: default","handlingStrategy":"validation","validationCode":"# Validate that every feature value is a scalar or mapping, never a sequence.\n# Use a YAML parser (e.g. PyYAML) and check node types:\nimport yaml, pathlib\nlocales_dir = pathlib.Path('src/Humanizer/Locales')\nfor f in locales_dir.rglob('*.yml'):\n    data = yaml.safe_load(f.read_text())\n    if not isinstance(data, dict):\n        continue\n    for key, val in data.items():\n        if isinstance(val, list):\n            print(f'{f.name}:{key} is a sequence but features must be scalar or mapping')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always check a known-good locale file for the expected shape of each feature before authoring.","Run a YAML linter that flags sequence values under feature keys.","Avoid leading '- ' under any feature key unless the feature schema explicitly requires a sequence (like headings sub-keys)."],"tags":["locale","yaml","source-generator","feature","schema"],"backgroundTag":null,"analyzedSha":"ffc2b77c0f30d2fb176875841424379319d0ae9b","analyzedAt":"2026-08-13T21:42:34.584Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}