{"record":{"id":"64787e4ec5922aa5","repo":"Humanizr/Humanizer","slug":"unsupported-number-to-words-builder-member-build","errorCode":null,"errorMessage":"Unsupported number-to-words builder '{member.Builder}'.","messagePattern":"Unsupported number-to-words builder '(.+?)'\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Humanizer.SourceGenerators/Generators/ProfileCatalogs/NumberToWordsEngineContractFactory.cs","lineNumber":536,"sourceCode":"                \"scale-leading-compound-scale-array\" => CreateScaleLeadingCompoundScaleArrayExpression(builderRoot),\n                \"scandinavian-scale-array\" => CreateScaleStrategyScaleArrayExpression(builderRoot),\n                \"unit-leading-compound-scale-array\" => CreateUnitLeadingCompoundScaleArrayExpression(builderRoot),\n                \"conjoined-gendered-scale-array\" => CreateConjoinedGenderedScaleArrayExpression(builderRoot),\n                \"segmented-scale-array\" => CreateSegmentedScaleArrayExpression(builderRoot),\n                \"stemmed-scale-array\" => CreateStemmedScaleArrayExpression(builderRoot),\n                \"linked-vigesimal-scale-array\" => CreateLinkedVigesimalScaleArrayExpression(builderRoot),\n                \"terminal-ordinal-scale-array\" => CreateTerminalOrdinalScaleArrayExpression(builderRoot),\n                \"construct-state-scale-array\" => CreateConstructStateScaleArrayExpression(builderRoot),\n                \"hyphenated-scale\" => CreateHyphenatedScaleExpression(builderRoot),\n                \"hyphenated-scale-array\" => CreateHyphenatedScaleArrayExpression(builderRoot),\n                \"hyphenated-ordinal-scale-array\" => CreateHyphenatedOrdinalScaleArrayExpression(builderRoot),\n                \"dual-form-scale\" => CreateDualFormScaleExpression(builderRoot),\n                \"macedonian-scale-array\" => CreateMacedonianScaleArrayExpression(builderRoot),\n                \"triad-scale-array\" => CreateTriadScaleArrayExpression(builderRoot),\n                \"gendered-scale-ordinal-array\" => CreateGenderedScaleOrdinalArrayExpression(builderRoot),\n                \"long-scale-word-array\" => CreateLongScaleWordArrayExpression(builderRoot),\n                \"variant-decade-scale-array\" => CreateVariantDecadeScaleArrayExpression(builderRoot),\n                _ => throw new InvalidOperationException($\"Unsupported number-to-words builder '{member.Builder}'.\")\n            };\n        }\n\n        static string GetStringValue(JsonElement root, EngineContractMember member)\n        {\n            if (EngineContractUtilities.TryGetOptionalString(root, member.SourcePath, out var value))\n            {\n                return value!;\n            }\n\n            if (member.FallbackSourcePath is not null && EngineContractUtilities.TryGetOptionalString(root, member.FallbackSourcePath, out var fallback))\n            {\n                return fallback!;\n            }\n\n            if (member.DefaultValue is not null)\n            {\n                return member.DefaultValue;","sourceCodeStart":518,"sourceCodeEnd":554,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer.SourceGenerators/Generators/ProfileCatalogs/NumberToWordsEngineContractFactory.cs#L518-L554","documentation":"The builder dispatch switch in CreateBuilderValue handles ~40 named builders (harmony-ordinal-scale-array, billion-strategy-cardinal-scale-array, etc.). Any builder string not matching a case hits the default arm and throws. This is a generator-level configuration error indicating the contract references a builder the factory does not implement.","triggerScenarios":"An EngineContractMember has a Builder value not present in the switch cases at lines 498-536. For example, a typo like 'billion-strategy-scale-array' (missing 'cardinal') or a completely new builder name without a corresponding case.","commonSituations":"Typo in the builder name string. Referencing a builder from an older/newer version that was renamed or removed. Adding a new builder concept without implementing its expression generator.","solutions":["Correct the builder name to match exactly one of the supported names in the switch (check spelling, hyphens, and ordering).","If the builder is new, add a case to the switch and implement the CreateXxxScaleArrayExpression method.","If the builder was renamed, update the contract definition to use the current name."],"exampleFix":"// before\nnew EngineContractMember(\n    kind: \"builder\",\n    sourcePath: \"scales\",\n    builder: \"billion-cardinal-scale-array\",\n    ...)\n// after\nnew EngineContractMember(\n    kind: \"builder\",\n    sourcePath: \"scales\",\n    builder: \"billion-strategy-cardinal-scale-array\",\n    ...)","handlingStrategy":"validation","validationCode":"// Validate all builder names are supported before generation:\nstatic readonly HashSet<string> SupportedBuilders = new()\n{\n    \"harmony-ordinal-scale-array\",\"billion-strategy-cardinal-scale-array\",\n    /* ... all ~40 builders ... */\n};\nforeach (var m in contract.Members)\n    if (m.Kind == \"builder\" && !SupportedBuilders.Contains(m.Builder))\n        throw new ArgumentException($\"Unsupported builder '{m.Builder}'.\");","typeGuard":"static bool IsBuilderSupported(string builder) =>\n    SupportedBuilders.Contains(builder);","tryCatchPattern":null,"preventionTips":["Copy builder names exactly from the switch cases — verify spelling, hyphens, and word order.","When adding a new builder, add it to both the switch and the supported-builders set.","Write a test that checks every builder in every contract against the factory switch."],"tags":["source-generator","number-to-words","contract","builder","engine-contract","build-time"],"backgroundTag":null,"analyzedSha":"ffc2b77c0f30d2fb176875841424379319d0ae9b","analyzedAt":"2026-08-13T21:42:34.584Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}