{"record":{"id":"8835c8ee97529688","repo":"Humanizr/Humanizer","slug":"property-propertyname-must-be-a-mapping","errorCode":null,"errorMessage":"Property '{propertyName}' must be a mapping.","messagePattern":"Property '(.+?)' must be a mapping\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Humanizer.SourceGenerators/Common/GenerationHelpers.cs","lineNumber":1022,"sourceCode":"            OptionalStringValue(\"countWordFormNextWord\"));\n\n    static string CreateUnitLeadingCompoundOrdinalPairExpression(JsonElement element, string propertyName)\n    {\n        return !element.TryGetProperty(propertyName, out var property)\n            ? throw new InvalidOperationException($\"Missing required property '{propertyName}'.\")\n            : property.ValueKind switch\n            {\n                JsonValueKind.String => \"new string[] { \" + QuoteLiteral(property.GetString()!) + \", \" + QuoteLiteral(property.GetString()!) + \" }\",\n                JsonValueKind.Array => CreateStringArrayExpression(property),\n                JsonValueKind.Object => CreateTerminalContinuingStringArrayExpression(property, propertyName),\n                _ => throw new InvalidOperationException($\"Property '{propertyName}' must be a string, array, or mapping (got {property.ValueKind}).\")\n            };\n    }\n\n    static string CreateTerminalContinuingStringArrayExpression(JsonElement objectElement, string propertyName)\n    {\n        return objectElement.ValueKind != JsonValueKind.Object\n            ? throw new InvalidOperationException($\"Property '{propertyName}' must be a mapping.\")\n            : \"new string[] { \" +\n               QuoteLiteral(GetRequiredString(objectElement, \"terminal\")) + \", \" +\n               QuoteLiteral(GetRequiredString(objectElement, \"continuing\")) +\n               \" }\";\n    }\n\n    static string CreateConjoinedGenderedScaleArrayExpression(JsonElement arrayElement)\n        => CreateTypedConstructorArrayExpression(\n            \"ConjoinedGenderedScale\",\n            arrayElement,\n            RequiredInt64Value(\"divisor\"),\n            RequiredEnumValue(\"gender\", \"GrammaticalGender\"),\n            RequiredStringValue(\"singular\"),\n            RequiredStringValue(\"plural\"),\n            RequiredStringValue(\"ordinalStem\"));\n\n    static string CreateSegmentedScaleArrayExpression(JsonElement arrayElement)\n        => CreateTypedConstructorArrayExpression(","sourceCodeStart":1004,"sourceCodeEnd":1040,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer.SourceGenerators/Common/GenerationHelpers.cs#L1004-L1040","documentation":"Thrown by CreateTerminalContinuingStringArrayExpression when an ordinal pair that resolved as a JSON object lacks the required shape. The generator reached this branch because the parent ordinal value was a mapping, but the inner value is not itself a mapping (it is a scalar or array), so it cannot read the 'terminal' and 'continuing' sub-keys.","triggerScenarios":"A locale YAML defines ordinalSingular or ordinalPlural as a nested non-mapping (e.g. a sequence) that the generator routed to the object branch, or the value is a scalar inside a mapping context. The ValueKind check rejects anything that is not JsonValueKind.Object.","commonSituations":"Mixing the two mapping forms for ordinal pairs: providing a sequence where a mapping with 'terminal'/'continuing' was expected, or nesting scalars incorrectly. This is a build-time generator failure localized to the offending ordinal pair.","solutions":["If you intend a terminal/continuing pair, make the ordinal value a mapping with exactly 'terminal' and 'continuing' string keys.","If you intend a list of forms, keep the value as a YAML sequence so the generator uses the array branch instead of the object branch.","Rebuild after correcting the shape to confirm the generator accepts it."],"exampleFix":"# before\nordinalSingular:\n  - 'pierwszy'\n# after\nordinalSingular:\n  terminal: 'pierwszy'\n  continuing: 'pierwszego'","handlingStrategy":"validation","validationCode":"// When using the mapping form for an ordinal pair, assert the node is a\n// mapping with exactly 'terminal' and 'continuing' scalar keys.","typeGuard":null,"tryCatchPattern":null,"preventionTips":["If you need a list of forms, use the YAML sequence branch, not a nested mapping.","For terminal/continuing pairs, use exactly those two keys and string values.","Rebuild after editing ordinal pair shapes."],"tags":["source-generator","locale-yaml","configuration","build-time","ordinal","humanizer"],"backgroundTag":null,"analyzedSha":"ffc2b77c0f30d2fb176875841424379319d0ae9b","analyzedAt":"2026-08-13T21:42:34.584Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}