Humanizr/Humanizer · error · InvalidOperationException

Linked-vigesimal number profiles require at least a zero wor

Error message

Linked-vigesimal number profiles require at least a zero word.

What it means

Profile constructor validation: the Words table must contain at least a zero word (length > 0). An empty table is rejected at instantiation.

Source

Thrown at src/Humanizer/Localisation/NumberToWords/LinkedVigesimalNumberToWordsConverter.cs:180

    /// <summary>Gets the terminal low-remainder linker for the rendered remainder.</summary>
    public string GetTerminalRemainderJoiner(string renderedRemainder)
    {
        if (TerminalRemainderAlternateJoiner.Length > 0 &&
            renderedRemainder.Length > 0 &&
            TerminalRemainderAlternateJoinerInitials.Contains(renderedRemainder[0]))
        {
            return TerminalRemainderAlternateJoiner;
        }

        return TerminalRemainderJoiner;
    }

    static string[] ValidateWords(string[] value)
    {
        if (value.Length == 0)
        {
            throw new InvalidOperationException("Linked-vigesimal number profiles require at least a zero word.");
        }

        return value;
    }

    static LinkedVigesimalScale[] ValidateScales(LinkedVigesimalScale[] value)
    {
        for (var i = 0; i < value.Length; i++)
        {
            if (value[i].Value <= 0)
            {
                throw new InvalidOperationException("Linked-vigesimal number profiles require positive scale values.");
            }

            if (i > 0 && value[i - 1].Value <= value[i].Value)
            {
                throw new InvalidOperationException("Linked-vigesimal number profiles require descending scales.");
            }

View on GitHub (pinned to ffc2b77c0f)

Solutions

  1. Report the locale bug — the words table is empty.
  2. Use a locale with a populated words table.
  3. If authoring, provide at least the zero word in the locale YAML.
Defensive patterns

Strategy: try-catch

Validate before calling

// Construction-time validation; no public pre-check. Isolate converter resolution per culture.

Try / catch

string words;
try
{
    words = value.ToWords(culture);
}
catch (InvalidOperationException ex) when (ex.Message.Contains("at least a zero word"))
{
    words = value.ToWords(CultureInfo.InvariantCulture);
}

Prevention

When it happens

Trigger: First converter use for a linked-vigesimal culture whose words array is empty.

Common situations: Locale YAML missing the lexicalized words list entirely.

Related errors


AI-assisted analysis of Humanizr/Humanizer@ffc2b77c0f (2026-08-13). Data as JSON: /api/errors/5b5fd9618d9066c2. Report an issue: GitHub.