{"record":{"id":"27eeba38994d9102","repo":"Humanizr/Humanizer","slug":"calendar-key-items-must-be-strings","errorCode":null,"errorMessage":"calendar.{key} items must be strings.","messagePattern":"calendar\\.(.+?) items must be strings\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Humanizer.SourceGenerators/Generators/ProfileCatalogs/OrdinalDateProfileCatalogInput.cs","lineNumber":48,"sourceCode":"                AddProfile(dateOnlyProfiles, locale.DateOnlyToOrdinalWords, seenDateOnly, months, monthsGenitive, hijriMonths);\n            }\n\n            return new OrdinalDateProfileCatalogInput(dateProfiles.ToImmutable(), dateOnlyProfiles.ToImmutable());\n        }\n\n        static ImmutableArray<string> ExtractCalendarMonths(SimpleYamlMapping? calendar, string key)\n        {\n            if (calendar is null || !calendar.TryGetValue(key, out var value) || value is not SimpleYamlSequence sequence)\n            {\n                return ImmutableArray<string>.Empty;\n            }\n\n            var builder = ImmutableArray.CreateBuilder<string>(sequence.Items.Length);\n            foreach (var item in sequence.Items)\n            {\n                if (item is not SimpleYamlScalar scalar)\n                {\n                    throw new InvalidOperationException($\"calendar.{key} items must be strings.\");\n                }\n\n                builder.Add(scalar.Value);\n            }\n\n            return builder.MoveToImmutable();\n        }\n\n        static void AddProfile(\n            ImmutableArray<OrdinalDateProfileDefinition>.Builder profiles,\n            LocaleFeature? feature,\n            HashSet<string> seenProfiles,\n            ImmutableArray<string> months,\n            ImmutableArray<string> monthsGenitive,\n            ImmutableArray<string> hijriMonths)\n        {\n            if (feature is not { UsesGeneratedProfile: true } ||\n                !seenProfiles.Add(feature.ProfileName!))","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer.SourceGenerators/Generators/ProfileCatalogs/OrdinalDateProfileCatalogInput.cs#L30-L66","documentation":"Thrown during source generation by ExtractCalendarMonths when parsing a calendar sequence (calendar.months, calendar.monthsGenitive, or calendar.hijriMonths) from an ordinal-date locale YAML. Each item in the YAML sequence must be a scalar string; if any item is a mapping, null, or another non-scalar YAML node, the generator rejects it with this message naming the offending key.","triggerScenarios":"An ordinal-date locale YAML declares a calendar.months (or monthsGenitive or hijriMonths) sequence, but one or more entries are not plain string scalars — for example, a nested mapping with a value key, a quoted multi-word structure parsed as a map, or a null entry.","commonSituations":"A maintainer edits month names in a locale YAML and accidentally introduces a syntax error (e.g. a colon inside a month name that YAML interprets as a key-value pair, or a tab indentation issue that produces a nested node).","solutions":["Open the locale YAML and inspect the calendar.{key} sequence flagged in the error message.","Ensure every item in that sequence is a plain or quoted string scalar with no colons or nested mappings.","Quote month names that contain special YAML characters (colons, brackets) using single or double quotes.","Rebuild to confirm the generator parses all month entries as strings."],"exampleFix":"# locale YAML — before (colon in month name parsed as mapping)\ncalendar:\n  months:\n    - January\n    - month: February\n\n# after\ncalendar:\n  months:\n    - January\n    - February","handlingStrategy":"validation","validationCode":"// Before building, validate that all calendar.{key} sequences in ordinal-date\n// locale YAML contain only string scalars. Use a YAML parser to load and check:\n// foreach item in sequence: assert item is scalar.","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Quote any month name containing YAML special characters (colons, brackets, commas).","Validate YAML indentation in locale files — tabs are not allowed in YAML.","Run a YAML syntax check on modified locale files before building."],"tags":["source-generator","locale-yaml","ordinal-date","calendar","build-time"],"backgroundTag":null,"analyzedSha":"ffc2b77c0f30d2fb176875841424379319d0ae9b","analyzedAt":"2026-08-13T21:42:34.584Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}