{"record":{"id":"a492f7570fb9d46f","repo":"Humanizr/Humanizer","slug":"indian-scale-form-number-profiles-require-scales-i","errorCode":null,"errorMessage":"Indian scale-form number profiles require scales in descending order.","messagePattern":"Indian scale-form number profiles require scales in descending order\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Humanizer/Localisation/NumberToWords/IndianScaleFormNumberToWordsConverter.cs","lineNumber":165,"sourceCode":"    }\n\n    static IndianScaleForm[] ValidateScales(IndianScaleForm[] value, int denseUnitCount)\n    {\n        if (value.Length == 0 || value[^1].Value > denseUnitCount)\n        {\n            throw new InvalidOperationException(\"Indian scale-form number profiles require a scale value covered by the dense unit map range.\");\n        }\n\n        for (var i = 0; i < value.Length; i++)\n        {\n            if (value[i].Value <= 0)\n            {\n                throw new InvalidOperationException(\"Indian scale-form number profiles require positive scale values.\");\n            }\n\n            if (i > 0 && value[i - 1].Value <= value[i].Value)\n            {\n                throw new InvalidOperationException(\"Indian scale-form number profiles require scales in descending order.\");\n            }\n        }\n\n        return value;\n    }\n}\n\n/// <summary>\n/// Describes one scale row with exact and continuing forms.\n/// </summary>\n/// <param name=\"Value\">The numeric scale value.</param>\n/// <param name=\"Singular\">The singular scale form used when the phrase ends at this scale.</param>\n/// <param name=\"SingularWithRemainder\">The singular scale form used before a remainder.</param>\n/// <param name=\"Plural\">The plural scale form used when the phrase ends at this scale.</param>\n/// <param name=\"PluralWithRemainder\">The plural scale form used before a remainder.</param>\n/// <param name=\"OmitOne\">Whether a count of one is omitted before the singular scale form.</param>\nreadonly record struct IndianScaleForm(\n    long Value,","sourceCodeStart":147,"sourceCodeEnd":183,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer/Localisation/NumberToWords/IndianScaleFormNumberToWordsConverter.cs#L147-L183","documentation":"Profile constructor validation: scale rows must be in strictly descending Value order. Equal or increasing adjacent values are rejected at instantiation.","triggerScenarios":"First converter use for an IndianScaleForm culture whose scales are not strictly descending (value[i-1].Value <= value[i].Value for some adjacent pair).","commonSituations":"Locale YAML listing scales in the wrong order, or duplicate scale values.","solutions":["Report the locale bug — scales are not strictly descending.","Use a locale with correctly ordered scales.","If authoring, order scale rows by descending Value with no duplicates."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Construction-time validation; no public pre-check. Isolate converter resolution per culture.","typeGuard":null,"tryCatchPattern":"string words;\ntry\n{\n    words = value.ToWords(culture);\n}\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"scales in descending order\"))\n{\n    words = value.ToWords(CultureInfo.InvariantCulture);\n}","preventionTips":["Smoke-test converter resolution per locale at startup.","Report unordered/duplicate scales upstream.","Pin consistent Humanizer versions."],"tags":["number-to-words","profile-data","localization","construction-validation"],"backgroundTag":null,"analyzedSha":"ffc2b77c0f30d2fb176875841424379319d0ae9b","analyzedAt":"2026-08-13T21:42:34.584Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}