{"record":{"id":"48cbebd5ffa9e6e4","repo":"Humanizr/Humanizer","slug":"prefixed-scale-token-property-name-must-map-to","errorCode":null,"errorMessage":"Prefixed scale token '{property.Name}' must map to an integer value.","messagePattern":"Prefixed scale token '(.+?)' must map to an integer value\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Humanizer.SourceGenerators/Common/GenerationHelpers.cs","lineNumber":1331,"sourceCode":"            RequiredInt64Value(\"value\"));\n\n    static string CreatePrefixedScaleWordArrayExpression(JsonElement arrayElement)\n    {\n        if (arrayElement.ValueKind is not (JsonValueKind.Array or JsonValueKind.Object))\n        {\n            throw new InvalidOperationException(\"Expected JSON array or mapping.\");\n        }\n\n        var builder = new StringBuilder(\"new PrefixedScaleWord[] { \");\n        var first = true;\n\n        if (arrayElement.ValueKind == JsonValueKind.Object)\n        {\n            foreach (var (Name, Value) in arrayElement.EnumerateObject()\n                         .Select(static property =>\n                         {\n                             return property.Value.ValueKind != JsonValueKind.Number || !property.Value.TryGetInt64(out var value)\n                                 ? throw new InvalidOperationException($\"Prefixed scale token '{property.Name}' must map to an integer value.\")\n                                 : (property.Name, Value: value);\n                         })\n                         .OrderByDescending(static entry => entry.Value)\n                         .ThenBy(static entry => entry.Name, StringComparer.Ordinal))\n            {\n                if (!first)\n                {\n                    builder.Append(\", \");\n                }\n\n                builder.Append(\"new(\");\n                builder.Append(QuoteLiteral(Name));\n                builder.Append(\", \");\n                builder.Append(Value.ToString(CultureInfo.InvariantCulture));\n                builder.Append(')');\n                first = false;\n            }\n        }","sourceCodeStart":1313,"sourceCodeEnd":1349,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer.SourceGenerators/Common/GenerationHelpers.cs#L1313-L1349","documentation":"Thrown while building a PrefixedScaleWord[] when the YAML node is a mapping but one of its values is not an integer. The builder maps each prefix token to an integer value; a non-numeric value cannot become the scale's numeric component.","triggerScenarios":"A locale YAML defines the prefixed-scale section as a mapping where at least one entry's value is a string, boolean, or non-integer number. The Select lambda checks ValueKind and TryGetInt64 and throws, naming the offending token.","commonSituations":"A contributor adds a prefix token but supplies a word as the value instead of the integer magnitude. The build error names the specific token that is wrong.","solutions":["Set each prefixed-scale token's value to an unquoted integer: kilo: 1000.","Remove any string, boolean, or decimal values from the mapping.","Rebuild; the generator names the first remaining offending token."],"exampleFix":"# before\nprefixedScale:\n  kilo: 'thousand'\n# after\nprefixedScale:\n  kilo: 1000","handlingStrategy":"validation","validationCode":"# Every prefixed-scale token must map to an unquoted integer:\n#   rg -A10 \"prefixedScale\" src/Humanizer/Locales/<code>.yml\n# No value should be a quoted string or boolean.","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use unquoted integer magnitudes for every prefixed-scale token.","Avoid placing words as mapping values; they belong as keys.","Build locally so the generator pinpoints the first bad token."],"tags":["source-generator","locale-yaml","configuration","build-time","humanizer"],"backgroundTag":null,"analyzedSha":"ffc2b77c0f30d2fb176875841424379319d0ae9b","analyzedAt":"2026-08-13T21:42:34.584Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}