{"record":{"id":"5e8b7cbbdbfed284","repo":"Humanizr/Humanizer","slug":"the-scale-profile-must-include-the-thousand-row","errorCode":null,"errorMessage":"The scale profile must include the thousand row.","messagePattern":"The scale profile must include the thousand row\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Humanizer/Localisation/NumberToWords/HyphenatedOrdinalNumberToWordsConverter.cs","lineNumber":138,"sourceCode":"            var scaleOrdinal = gender == GrammaticalGender.Feminine\n                ? scale.OrdinalFeminine\n                : scale.OrdinalMasculine;\n            if (remainder == 0)\n            {\n                return count == 1\n                    ? scaleOrdinal\n                    : ConvertPositive(\n                        count,\n                        scale.CountUsesRequestedGender ? gender : GrammaticalGender.Masculine,\n                        true,\n                        false) + \" \" + scaleOrdinal;\n            }\n\n            return ConvertPositive(number - remainder, gender, false, false) + \" \" +\n                   ConvertToOrdinalPositive(remainder, gender);\n        }\n\n        throw new InvalidOperationException(\"The scale profile must include the thousand row.\");\n    }\n\n    /// <summary>\n    /// Converts the given value to an ordinal abbreviation when requested.\n    /// </summary>\n    /// <param name=\"number\">The number to convert.</param>\n    /// <param name=\"gender\">The grammatical gender to use.</param>\n    /// <param name=\"wordForm\">The requested word form.</param>\n    /// <returns>The localized ordinal abbreviation or full ordinal words for <paramref name=\"number\"/>.</returns>\n    public override string ConvertToOrdinal(int number, GrammaticalGender gender, WordForm wordForm)\n    {\n        if (wordForm != WordForm.Abbreviation)\n        {\n            return ConvertToOrdinal(number, gender);\n        }\n\n        // Abbreviation mode is its own contract: the caller wants the abbreviated ordinal, not the\n        // full hyphenated spelling.","sourceCodeStart":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer/Localisation/NumberToWords/HyphenatedOrdinalNumberToWordsConverter.cs#L120-L156","documentation":"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.","triggerScenarios":"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.","commonSituations":"Locale profile authored ordinal scales that don't reach down to 1000, or the number exceeds the largest authored scale.","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."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// No public API exposes the scale table coverage. For HyphenatedOrdinal locales, keep values\n// within the locale's authored ordinal range or fall back on the exception.","typeGuard":null,"tryCatchPattern":"string ordinal;\ntry\n{\n    ordinal = number.ToOrdinalWords(gender, culture);\n}\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"thousand row\"))\n{\n    ordinal = number.ToOrdinalWords(gender, CultureInfo.InvariantCulture);\n}","preventionTips":["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."],"tags":["number-to-words","ordinal","profile-data","localization"],"backgroundTag":null,"analyzedSha":"ffc2b77c0f30d2fb176875841424379319d0ae9b","analyzedAt":"2026-08-13T21:42:34.584Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}