{"record":{"id":"e71d799a12729755","repo":"Humanizr/Humanizer","slug":"path-provenance-must-not-be-empty","errorCode":null,"errorMessage":"'{path}.provenance' must not be empty.","messagePattern":"'(.+?)\\.provenance' must not be empty\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Humanizer.SourceGenerators/Common/DurationCaseModels.cs","lineNumber":1073,"sourceCode":"            {\n                if (item is not SimpleYamlScalar scalar || string.IsNullOrWhiteSpace(scalar.Value))\n                {\n                    throw new InvalidOperationException(\n                        $\"'{path}.provenance' must contain non-empty source identifiers.\");\n                }\n\n                if (!seen.Add(scalar.Value))\n                {\n                    throw new InvalidOperationException(\n                        $\"'{path}.provenance' contains duplicate source '{scalar.Value}'.\");\n                }\n\n                result.Add(scalar.Value);\n            }\n\n            if (required && result.Count == 0)\n            {\n                throw new InvalidOperationException($\"'{path}.provenance' must not be empty.\");\n            }\n\n            return result.MoveToImmutable();\n        }\n\n        static void ValidateProvenance(\n            ImmutableArray<string> provenance,\n            ImmutableDictionary<string, DurationCaseSource> sources,\n            string path)\n        {\n            foreach (var sourceId in provenance.Where(sourceId => !sources.ContainsKey(sourceId)))\n            {\n                throw new InvalidOperationException(\n                    $\"'{path}.provenance' references unknown source '{sourceId}'.\");\n            }\n        }\n\n        static string RequireScalar(SimpleYamlMapping mapping, string key, string path) =>","sourceCodeStart":1055,"sourceCodeEnd":1091,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer.SourceGenerators/Common/DurationCaseModels.cs#L1055-L1091","documentation":"Thrown by ParseProvenance when required is true, the provenance key exists and is a valid sequence, but the sequence contains zero items. After iterating, the parser checks result.Count == 0 and throws if the list is empty.","triggerScenarios":"The 'provenance' key is present and is a valid YAML sequence, but the sequence is empty (e.g. provenance: []).","commonSituations":"A contributor adds the provenance key as an empty list as a placeholder, or a YAML template generates an empty sequence. The generator requires at least one source for phrase, sameRenderedAs, and notApplicable realizations.","solutions":["Populate the provenance sequence with at least one valid source ID defined in the locale's sources registry.","Rebuild to confirm the non-empty provenance is accepted."],"exampleFix":"# before\nprovenance: []\n# after\nprovenance: [cldr-42]","handlingStrategy":"validation","validationCode":"# Verify required provenance is non-empty\n# python: if required: assert len(unit['provenance']) > 0, 'provenance must not be empty'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never leave provenance as an empty list placeholder; populate it with at least one source ID.","If unsure of the source, add a placeholder source entry and reference it, then update later.","Build immediately after adding the provenance key to catch empty-list errors."],"tags":["humanizer","locale","yaml","source-generator","duration-cases","provenance","build-time"],"backgroundTag":null,"analyzedSha":"ffc2b77c0f30d2fb176875841424379319d0ae9b","analyzedAt":"2026-08-13T21:42:34.584Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}