Humanizr/Humanizer · error · InvalidOperationException
'{path}.unsupported' must be true.
Error message
'{path}.unsupported' must be true. What it means
Mirror of error 102 for the 'unsupported' flag. ParseUnit (DurationCaseModels.cs:1170-1173) accepts 'unsupported' only when it is exactly boolean true. A unit is either explicitly unsupported (true) or it carries a phrase/sameAsNominative; false or non-boolean values are invalid.
Source
Thrown at src/Humanizer.SourceGenerators/Common/DurationCaseModels.cs:1172
var mapping = ExpectMapping(value, path);
if (mapping.GetScalar("sameAsNominative") is { } sameAsNominative)
{
RejectUnknownKeys(mapping, path, ["sameAsNominative"]);
if (!bool.TryParse(sameAsNominative, out var enabled) || !enabled)
{
throw new InvalidOperationException($"'{path}.sameAsNominative' must be true.");
}
return new DurationCaseUnit(DurationCaseUnitKind.SameAsNominative, null);
}
if (mapping.GetScalar("unsupported") is { } unsupported)
{
RejectUnknownKeys(mapping, path, ["unsupported"]);
if (!bool.TryParse(unsupported, out var enabled) || !enabled)
{
throw new InvalidOperationException($"'{path}.unsupported' must be true.");
}
return new DurationCaseUnit(DurationCaseUnitKind.Unsupported, null);
}
var phrase = LocalePhraseNormalization.ParseTimeSpanPhrase(value, path);
if (phrase.Single is null ||
phrase.Multiple?.Forms is null)
{
throw new InvalidOperationException(
$"Case overlay '{path}' must explicitly define singular and numeric multiple forms.");
}
return new DurationCaseUnit(DurationCaseUnitKind.Phrase, phrase);
}
static bool ContainsInheritanceMarker(SimpleYamlValue value) =>
value switchView on GitHub (pinned to ffc2b77c0f)
Solutions
- If the unit is genuinely unsupported, set 'unsupported: true' (plain YAML boolean).
- Otherwise remove the unsupported key and provide sameAsNominative: true or a full phrase: block.
Example fix
# before year: unsupported: false # after - unit is supported year: sameAsNominative: true
Defensive patterns
Strategy: validation
Validate before calling
# An unsupported unit must be exactly true
foreach ($u in $caseUnits.GetEnumerator()) {
if ($u.Value -is [hashtable] -and $u.Value.ContainsKey('unsupported') `
-and $u.Value.unsupported -ne $true) {
throw "unit '$($u.Key)': unsupported must be true (got $($u.Value.unsupported))"
}
} Prevention
- Use 'unsupported: true' only; to make a unit supported again, delete the key.
- Keep unsupported and sameAsNominative mutually exclusive within one unit.
When it happens
Trigger: unsupported is set to false, a quoted string, or another non-true scalar.
Common situations: A contributor marks a unit unsupported then sets 'unsupported: false' to toggle it back — the schema has no false branch, so the key should be removed instead.
Related errors
- '{path}.units' must explicitly define '{unitName}'.
- '{path}.sameAsNominative' must be true.
- Case overlay '{path}' must explicitly define singular and nu
- '{path}' must be a mapping.
- '{path}' defines unsupported property '{key}'. Supported pro
AI-assisted analysis of Humanizr/Humanizer@ffc2b77c0f (2026-08-13).
Data as JSON: /api/errors/e40355cbb1350c2c.
Report an issue: GitHub.