{"record":{"id":"3783d996215fb39f","repo":"Humanizr/Humanizer","slug":"failed-to-generate-number-to-words-profile-profi","errorCode":null,"errorMessage":"Failed to generate number-to-words profile '{profile.ProfileName}' using engine '{profile.Engine}': {exception.Message}","messagePattern":"Failed to generate number-to-words profile '(.+?)' using engine '(.+?)': (.+?)","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Humanizer.SourceGenerators/Generators/ProfileCatalogs/NumberToWordsProfileCatalogInput.cs","lineNumber":115,"sourceCode":"                builder.AppendLine();\n            }\n\n            builder.AppendLine(\"}\");\n            context.AddSource(\"NumberToWordsProfileCatalog.g.cs\", SourceText.From(builder.ToString(), Encoding.UTF8));\n        }\n\n        static bool RequiresCulture(NumberToWordsProfileDefinition profile) =>\n            GetBoolean(profile.Root, \"useCulture\");\n\n        string CreateProfileExpression(NumberToWordsProfileDefinition profile, bool useCultureParameter)\n        {\n            try\n            {\n                return NumberToWordsEngineContractFactory.Create(profile, contracts, useCultureParameter);\n            }\n            catch (Exception exception)\n            {\n                throw new InvalidOperationException(\n                    $\"Failed to generate number-to-words profile '{profile.ProfileName}' using engine '{profile.Engine}': {exception.Message}\",\n                    exception);\n            }\n        }\n    }\n\n}","sourceCodeStart":97,"sourceCodeEnd":122,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer.SourceGenerators/Generators/ProfileCatalogs/NumberToWordsProfileCatalogInput.cs#L97-L122","documentation":"This is a wrapping exception thrown during source generation by CreateProfileExpression. It catches any exception from NumberToWordsEngineContractFactory.Create and re-throws it as an InvalidOperationException that includes the profile name and engine, with the original exception preserved as InnerException. It tells you which locale profile and which engine failed, and the inner message explains the specific cause.","triggerScenarios":"Any inner failure during number-to-words profile code emission — e.g. error 260 (missing integer), missing required string, unsupported enum value, or a malformed YAML structure for the engine. The wrapper fires for the first profile in the build that hits such an inner error.","commonSituations":"A Humanizer maintainer is adding or modifying a locale and one of its engine contract members has bad or missing data. The build error shows this message; the InnerException (shown in {exception.Message}) points at the real problem.","solutions":["Read the {exception.Message} portion of the error — it contains the inner exception's message which identifies the actual problem (e.g. 'Missing required integer property ...').","Fix the underlying locale YAML or engine contract issue indicated by the inner exception.","If the inner message is unclear, check the InnerException stack trace in the build log for the exact line in the generator that threw.","After fixing the root cause, rebuild to confirm all profiles emit successfully."],"exampleFix":"// build error: Failed to generate number-to-words profile 'fr-BE' using engine 'frenchStructural': Missing required integer property 'numberToWords.feminineThreshold'\n\n// Fix: add the missing property to the fr-BE locale YAML\nnumberToWords:\n  engine: frenchStructural\n  feminineThreshold: 100","handlingStrategy":"validation","validationCode":"// This is a build-time error. Prevent it by validating locale YAML\n// before building: ensure every numberToWords block satisfies its engine\n// contract's required fields. The inner exception message in the build\n// error pinpoints the exact missing or invalid property.","typeGuard":null,"tryCatchPattern":null,"preventionTips":["When a build fails with this wrapper, always read the colon-separated inner message — it names the real failure.","After fixing a locale YAML, run a clean rebuild to ensure no other profiles have the same issue.","Keep engine contract JSON and locale YAML in sync — changing a contract member requires updating all dependent locales."],"tags":["source-generator","number-to-words","build-time","wrapper-exception"],"backgroundTag":null,"analyzedSha":"ffc2b77c0f30d2fb176875841424379319d0ae9b","analyzedAt":"2026-08-13T21:42:34.584Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}