{"record":{"id":"b873cde4628e3bc3","repo":"Humanizr/Humanizer","slug":"inflection-source-entry-key-must-define-non-em","errorCode":null,"errorMessage":"Inflection source '{entry.Key}' must define non-empty kind and locator.","messagePattern":"Inflection source '(.+?)' must define non-empty kind and locator\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Humanizer.SourceGenerators/Generators/ProfileCatalogs/InflectionCatalogValidation.cs","lineNumber":116,"sourceCode":"        {\n            foreach (var source in GetRequiredStrings(mapping, \"sources\", $\"{subject} must define sources\"))\n            {\n                if (!sourceIds.Contains(source))\n                {\n                    throw new InvalidOperationException($\"{subject} references unknown source '{source}'.\");\n                }\n            }\n        }\n\n        static void ValidateSourceDefinitions(SimpleYamlMapping sources)\n        {\n            foreach (var entry in sources.Values)\n            {\n                if (entry.Value is not SimpleYamlMapping source ||\n                    source.GetScalar(\"kind\") is not { Length: > 0 } ||\n                    source.GetScalar(\"locator\") is not { Length: > 0 })\n                {\n                    throw new InvalidOperationException(\n                        $\"Inflection source '{entry.Key}' must define non-empty kind and locator.\");\n                }\n\n                ValidateProperties(\n                    source,\n                    $\"Inflection source '{entry.Key}'\",\n                    \"kind\", \"locator\", \"revision\", \"credit\");\n                foreach (var optionalProperty in new[] { \"revision\", \"credit\" })\n                {\n                    if (source.TryGetValue(optionalProperty, out var optionalValue) &&\n                        (optionalValue is not SimpleYamlScalar optionalScalar ||\n                         string.IsNullOrWhiteSpace(optionalScalar.Value)))\n                    {\n                        throw new InvalidOperationException(\n                            $\"Inflection source '{entry.Key}' {optionalProperty} must be a non-empty scalar.\");\n                    }\n                }\n            }","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer.SourceGenerators/Generators/ProfileCatalogs/InflectionCatalogValidation.cs#L98-L134","documentation":"Each entry in the inflection catalog's 'sources:' mapping must be a YAML map with non-empty 'kind' and 'locator' scalar fields. The 'kind' identifies the source type (e.g., 'cldr', 'treebank') and 'locator' identifies where the data comes from. This validator rejects source definitions missing either field or containing empty values.","triggerScenarios":"A source entry in the YAML is not a SimpleYamlMapping, or its 'kind' or 'locator' scalar is missing/empty. For example, a source defined as just a string instead of a map, or a map with only 'kind' and no 'locator'.","commonSituations":"Creating a new source entry and forgetting the 'locator' field. Defining a source as a bare string instead of a key-value map. Leaving a placeholder empty value during incremental editing.","solutions":["Add both 'kind' and 'locator' as non-empty string scalars to the offending source entry.","If the source entry is a scalar or wrong shape, convert it to a YAML mapping with 'kind' and 'locator' keys.","Remove the incomplete source definition if it was added by mistake, and remove all references to it."],"exampleFix":"# before\nsources:\n  custom1:\n    kind: 'dictionary'\n# after\nsources:\n  custom1:\n    kind: 'dictionary'\n    locator: 'Oxford English Dictionary, 2024 ed.'","handlingStrategy":"validation","validationCode":"# Before building, verify each source has non-empty kind and locator.\npython3 -c \"\nimport yaml, sys\nfor f in sys.argv[1:]:\n    d = yaml.safe_load(open(f))\n    sources = (d.get('inflection',{}).get('sources') or {})\n    for sid, sdef in sources.items():\n        if not isinstance(sdef, dict):\n            print(f'{f}: source {sid!r} is not a mapping')\n            continue\n        if not (sdef.get('kind') or '').strip():\n            print(f'{f}: source {sid!r} missing kind')\n        if not (sdef.get('locator') or '').strip():\n            print(f'{f}: source {sid!r} missing locator')\n\" src/Humanizer/Locales/*.yml","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use a YAML schema or template that includes kind and locator as required keys for every source entry.","During code review, verify new source definitions have both fields filled with non-empty strings.","Add a JSON Schema validation step in CI for locale YAML files."],"tags":["inflection","source-generator","sources","provenance","yaml","build-time"],"backgroundTag":null,"analyzedSha":"ffc2b77c0f30d2fb176875841424379319d0ae9b","analyzedAt":"2026-08-13T21:42:34.584Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}