{"record":{"id":"aabfc8b2f11cd102","repo":"Humanizr/Humanizer","slug":"path-must-define-provenance","errorCode":null,"errorMessage":"'{path}' must define provenance.","messagePattern":"'(.+?)' must define provenance\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Humanizer.SourceGenerators/Common/DurationCaseModels.cs","lineNumber":1043,"sourceCode":"            _ = resolving.Remove(node);\n            if (aliasing && result.Kind is DurationCaseUnitKind.NotApplicable or DurationCaseUnitKind.Unsupported)\n            {\n                throw new InvalidOperationException(\n                    $\"'{path}' aliases '{node}' to a case or unit that is not applicable or unsupported.\");\n            }\n\n            return result;\n        }\n\n        static ImmutableArray<string> ParseProvenance(\n            SimpleYamlMapping mapping,\n            string path,\n            bool required)\n        {\n            if (!mapping.TryGetValue(\"provenance\", out var value))\n            {\n                return required\n                    ? throw new InvalidOperationException($\"'{path}' must define provenance.\")\n                    : [];\n            }\n\n            if (value is not SimpleYamlSequence sequence)\n            {\n                throw new InvalidOperationException($\"'{path}.provenance' must be a sequence.\");\n            }\n\n            var result = ImmutableArray.CreateBuilder<string>(sequence.Items.Length);\n            var seen = new HashSet<string>(StringComparer.Ordinal);\n            foreach (var item in sequence.Items)\n            {\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","sourceCodeStart":1025,"sourceCodeEnd":1061,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer.SourceGenerators/Common/DurationCaseModels.cs#L1025-L1061","documentation":"Thrown by ParseProvenance when required is true and the mapping does not contain a 'provenance' key at all. Phrase, sameRenderedAs, and notApplicable realizations all require provenance (a citation chain); only the unsupported fallback makes it optional.","triggerScenarios":"A unit realization with a phrase, sameRenderedAs, or notApplicable discriminator is missing the 'provenance' key, so TryGetValue('provenance', ...) returns false and the required branch throws.","commonSituations":"A contributor authors a new duration-case realization but forgets to cite the source data. The generator enforces provenance for all renderable or aliased realizations to ensure traceability of linguistic data.","solutions":["Add a 'provenance' key to the unit realization mapping at the reported path.","Set it to a YAML sequence of source IDs that are defined in the locale's 'sources' section.","Rebuild to confirm provenance is accepted."],"exampleFix":"# before\nsecond:\n  phrase:\n    single: jedna sekunda\n    multiple:\n      forms:\n        default: sekund\n# after\nsecond:\n  phrase:\n    single: jedna sekunda\n    multiple:\n      forms:\n        default: sekund\n  provenance: [cldr-42]","handlingStrategy":"validation","validationCode":"# Verify provenance exists for phrase/sameRenderedAs/notApplicable realizations\n# python: for unit in realization_units:\n#     disc = [k for k in ('phrase','sameRenderedAs','notApplicable') if k in unit]\n#     if disc: assert 'provenance' in unit, 'missing provenance'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Add provenance as the last step when authoring any renderable or aliased realization.","Maintain a sources section in the locale YAML and reference valid IDs.","Build after each realization entry to catch missing-provenance errors at the specific path."],"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"}