Humanizr/Humanizer · error · InvalidOperationException
The scale profile must include the thousand row.
Error message
The scale profile must include the thousand row.
What it means
ConvertToOrdinalPositive walked every scale row and none covered the number, so there is no scale (starting at 1000) to build the ordinal from. The profile is missing the thousand row (or scales don't descend far enough), making any ordinal >= 1000 unrenderable for this HyphenatedOrdinal locale.
Source
Thrown at src/Humanizer/Localisation/NumberToWords/HyphenatedOrdinalNumberToWordsConverter.cs:138
var scaleOrdinal = gender == GrammaticalGender.Feminine
? scale.OrdinalFeminine
: scale.OrdinalMasculine;
if (remainder == 0)
{
return count == 1
? scaleOrdinal
: ConvertPositive(
count,
scale.CountUsesRequestedGender ? gender : GrammaticalGender.Masculine,
true,
false) + " " + scaleOrdinal;
}
return ConvertPositive(number - remainder, gender, false, false) + " " +
ConvertToOrdinalPositive(remainder, gender);
}
throw new InvalidOperationException("The scale profile must include the thousand row.");
}
/// <summary>
/// Converts the given value to an ordinal abbreviation when requested.
/// </summary>
/// <param name="number">The number to convert.</param>
/// <param name="gender">The grammatical gender to use.</param>
/// <param name="wordForm">The requested word form.</param>
/// <returns>The localized ordinal abbreviation or full ordinal words for <paramref name="number"/>.</returns>
public override string ConvertToOrdinal(int number, GrammaticalGender gender, WordForm wordForm)
{
if (wordForm != WordForm.Abbreviation)
{
return ConvertToOrdinal(number, gender);
}
// Abbreviation mode is its own contract: the caller wants the abbreviated ordinal, not the
// full hyphenated spelling.View on GitHub (pinned to ffc2b77c0f)
Solutions
- Report the locale bug — the ordinal scale table is missing the thousand row.
- Use a locale whose ordinal scales are complete for the magnitudes you convert.
- If authoring, ensure the Scales array descends through 1000 and covers the intended range.
Defensive patterns
Strategy: try-catch
Validate before calling
// No public API exposes the scale table coverage. For HyphenatedOrdinal locales, keep values // within the locale's authored ordinal range or fall back on the exception.
Try / catch
string ordinal;
try
{
ordinal = number.ToOrdinalWords(gender, culture);
}
catch (InvalidOperationException ex) when (ex.Message.Contains("thousand row"))
{
ordinal = number.ToOrdinalWords(gender, CultureInfo.InvariantCulture);
} Prevention
- Limit ordinal inputs to magnitudes the locale is known to support.
- After upgrading, test ordinals >= 1000 for each HyphenatedOrdinal locale.
- Report missing scale rows upstream.
When it happens
Trigger: number.ToOrdinalWords(gender) for a HyphenatedOrdinal locale with number >= 1000 when profile.Scales has no row whose Value <= number. Falls through the foreach to the throw.
Common situations: Locale profile authored ordinal scales that don't reach down to 1000, or the number exceeds the largest authored scale.
Related errors
- Unsupported harmony-ordinal suffix strategy.
- Harmony-ordinal suffix data is missing.
- Harmony-ordinal membership suffix data is incomplete.
- Indian scale-form number profiles require a scale value no g
- Indian scale-form number profiles require dense words for 0
AI-assisted analysis of Humanizr/Humanizer@ffc2b77c0f (2026-08-13).
Data as JSON: /api/errors/5e8b7cbbdbfed284.
Report an issue: GitHub.