Humanizr/Humanizer · error · InvalidOperationException
'{path}.provenance' must be a sequence.
Error message
'{path}.provenance' must be a sequence. What it means
Thrown by ParseProvenance when the 'provenance' key exists but its YAML value is not a SimpleYamlSequence (i.e. not a list). The parser requires provenance to be a sequence of source identifiers.
Source
Thrown at src/Humanizer.SourceGenerators/Common/DurationCaseModels.cs:1049
return result;
}
static ImmutableArray<string> ParseProvenance(
SimpleYamlMapping mapping,
string path,
bool required)
{
if (!mapping.TryGetValue("provenance", out var value))
{
return required
? throw new InvalidOperationException($"'{path}' must define provenance.")
: [];
}
if (value is not SimpleYamlSequence sequence)
{
throw new InvalidOperationException($"'{path}.provenance' must be a sequence.");
}
var result = ImmutableArray.CreateBuilder<string>(sequence.Items.Length);
var seen = new HashSet<string>(StringComparer.Ordinal);
foreach (var item in sequence.Items)
{
if (item is not SimpleYamlScalar scalar || string.IsNullOrWhiteSpace(scalar.Value))
{
throw new InvalidOperationException(
$"'{path}.provenance' must contain non-empty source identifiers.");
}
if (!seen.Add(scalar.Value))
{
throw new InvalidOperationException(
$"'{path}.provenance' contains duplicate source '{scalar.Value}'.");
}
View on GitHub (pinned to ffc2b77c0f)
Solutions
- Change the provenance value to a YAML sequence (square-bracket list syntax or block list syntax).
- Ensure each element is a scalar string matching a source ID in the sources registry.
- Rebuild to confirm the sequence is parsed.
Example fix
# before (scalar instead of sequence) provenance: cldr-42 # after provenance: [cldr-42]
Defensive patterns
Strategy: validation
Validate before calling
# Verify provenance is a list, not a scalar or mapping # python: assert isinstance(unit['provenance'], list), 'provenance must be a sequence'
Prevention
- Always use list syntax for provenance: [source-id] or block list with dashes.
- Even for a single source, wrap it in brackets.
- Review a known-good locale file for the correct provenance shape.
When it happens
Trigger: The 'provenance' key is set to a scalar string (e.g. provenance: cldr-42) or a mapping instead of a YAML list/array.
Common situations: A contributor writes provenance as a single bare string instead of a one-element list, or uses a mapping (key-value pairs) misunderstanding the expected shape.
Related errors
- '{path}' must define provenance.
- '{path}.provenance' must contain non-empty source identifier
- '{path}.provenance' contains duplicate source '{scalar.Value
- '{path}.provenance' must not be empty.
- '{path}.provenance' references unknown source '{sourceId}'.
AI-assisted analysis of Humanizr/Humanizer@ffc2b77c0f (2026-08-13).
Data as JSON: /api/errors/8f66cb3107c0f4ca.
Report an issue: GitHub.