{"record":{"id":"247d00d8859023e6","repo":"Humanizr/Humanizer","slug":"missing-required-integer-property-member-sourcep","errorCode":null,"errorMessage":"Missing required integer property '{member.SourcePath}'.","messagePattern":"Missing required integer property '(.+?)'\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Humanizer.SourceGenerators/Generators/ProfileCatalogs/NumberToWordsEngineContractFactory.cs","lineNumber":600,"sourceCode":"\n            return bool.TryParse(member.DefaultValue, out var defaultValue) && defaultValue;\n        }\n\n        static long GetInt64Value(JsonElement root, EngineContractMember member)\n        {\n            if (EngineContractUtilities.TryGetElement(root, member.SourcePath, out var value) &&\n                value.ValueKind == JsonValueKind.Number &&\n                value.TryGetInt64(out var number))\n            {\n                return number;\n            }\n\n            if (member.DefaultValue is not null && long.TryParse(member.DefaultValue, NumberStyles.Integer, CultureInfo.InvariantCulture, out number))\n            {\n                return number;\n            }\n\n            throw new InvalidOperationException($\"Missing required integer property '{member.SourcePath}'.\");\n        }\n\n        static long? GetOptionalInt64Value(JsonElement root, EngineContractMember member)\n        {\n            if (EngineContractUtilities.TryGetElement(root, member.SourcePath, out var value) &&\n                value.ValueKind == JsonValueKind.Number &&\n                value.TryGetInt64(out var number))\n            {\n                return number;\n            }\n\n            return member.DefaultValue is not null &&\n                   long.TryParse(member.DefaultValue, NumberStyles.Integer, CultureInfo.InvariantCulture, out number)\n                ? number\n                : null;\n        }\n\n    }","sourceCodeStart":582,"sourceCodeEnd":618,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer.SourceGenerators/Generators/ProfileCatalogs/NumberToWordsEngineContractFactory.cs#L582-L618","documentation":"Thrown during source generation by GetInt64Value when a number-to-words engine contract declares a required integer member, but the locale YAML neither provides that property as a JSON number at the member's SourcePath nor defines a DefaultValue fallback. The generator cannot emit a valid constructor argument for the converter, so it halts code emission with this message naming the missing SourcePath.","triggerScenarios":"Adding or editing a locale YAML under src/Humanizer/Locales whose numberToWords engine is bound to a structural contract (in EngineContractCatalog) that has an int32/int64 member. The locale omits the required integer field (or provides a non-numeric value such as a string or null), and the contract member has no DefaultValue set.","commonSituations":"A Humanizer maintainer adds a new locale or updates an existing locale's numberToWords block and forgets a required integer property (e.g. a threshold, offset, or mode flag). Also triggered when renaming a property in the engine contract JSON without updating all locale YAML files that use that engine.","solutions":["Open the locale YAML file referenced by the build error and add the missing integer property at the path indicated by {member.SourcePath} in the numberToWords block.","If the property should be optional, set a DefaultValue on the EngineContractMember in the engine contract definition so the generator has a fallback.","Verify the YAML indentation so the integer lands under the correct engine sub-object — a mis-indented scalar can appear as a missing property.","Run a clean rebuild (dotnet build) after fixing the YAML to confirm the source generator emits successfully."],"exampleFix":"// locale YAML — before\nnumberToWords:\n  engine: englishStructural\n  // missing required integer property 'feminineThreshold'\n\n// after\nnumberToWords:\n  engine: englishStructural\n  feminineThreshold: 100","handlingStrategy":"validation","validationCode":"// Before building, validate that every locale YAML numberToWords block\n// includes all required integer properties declared by its engine contract.\n// Cross-check the engine contract JSON in EngineContractCatalog for\n// members with kind 'int32'/'int64' and no defaultValue, then confirm the\n// locale YAML has those keys as numeric values.","typeGuard":null,"tryCatchPattern":null,"preventionTips":["When adding or modifying a number-to-words engine contract member of kind int32/int64 without a defaultValue, immediately update all locale YAML files that reference that engine.","Run dotnet build after any locale YAML change to catch generator errors early.","Use a YAML linter to catch indentation errors that can make properties appear missing."],"tags":["source-generator","locale-yaml","number-to-words","build-time"],"backgroundTag":null,"analyzedSha":"ffc2b77c0f30d2fb176875841424379319d0ae9b","analyzedAt":"2026-08-13T21:42:34.584Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}