{"record":{"id":"1045c04964cc90b3","repo":"Humanizr/Humanizer","slug":"unsupported-yaml-value-node","errorCode":null,"errorMessage":"Unsupported YAML value node.","messagePattern":"Unsupported YAML value node\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Humanizer.SourceGenerators/Common/LocaleYamlCatalog.cs","lineNumber":1067,"sourceCode":"                        WriteJson(writer, item);\n                    }\n\n                    writer.WriteEndArray();\n                    break;\n\n                case SimpleYamlMapping mapping:\n                    writer.WriteStartObject();\n                    foreach (var entry in mapping.Values)\n                    {\n                        writer.WritePropertyName(entry.Key);\n                        WriteJson(writer, entry.Value);\n                    }\n\n                    writer.WriteEndObject();\n                    break;\n\n                default:\n                    throw new InvalidOperationException(\"Unsupported YAML value node.\");\n            }\n        }\n\n        static void WriteScalar(Utf8JsonWriter writer, SimpleYamlScalar scalar)\n        {\n            if (scalar.IsString)\n            {\n                writer.WriteStringValue(scalar.Value);\n                return;\n            }\n\n            if (string.Equals(scalar.Value, \"null\", StringComparison.Ordinal))\n            {\n                writer.WriteNullValue();\n                return;\n            }\n\n            if (string.Equals(scalar.Value, \"true\", StringComparison.OrdinalIgnoreCase))","sourceCodeStart":1049,"sourceCodeEnd":1085,"githubUrl":"https://github.com/Humanizr/Humanizer/blob/ffc2b77c0f30d2fb176875841424379319d0ae9b/src/Humanizer.SourceGenerators/Common/LocaleYamlCatalog.cs#L1049-L1085","documentation":"When serializing parsed locale YAML into JSON for the generated profile, the writer handles three node types: scalar, sequence, and mapping. Reaching the default arm means a SimpleYamlValue subtype was encountered that the serializer does not recognize — an internal invariant violation that should be unreachable with the parser's own node types.","triggerScenarios":"Effectively unreachable through normal YAML input because SimpleYamlParser only ever produces SimpleYamlScalar, SimpleYamlSequence, and SimpleYamlMapping nodes. It would only fire if a code change introduced a new SimpleYamlValue subtype without updating WriteJson, or if a null node leaked into the tree.","commonSituations":"Modifying the source generator internals to add a new YAML value type; a bug in a custom fork that produces malformed node trees.","solutions":["If you are modifying the generator, add a case arm in WriteJson for the new SimpleYamlValue subtype.","If you are a locale author, this error indicates a generator bug, not a YAML mistake — report it with the locale file that triggered it.","Bisect recent generator changes to find where the unrecognized node type was introduced."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"# This is an internal generator invariant, not a YAML authoring error.\n# Validate the generator's node model if you modified it:\n# Ensure every SimpleYamlValue subtype has a case arm in WriteJson.\nimport subprocess\n# Grep for all SimpleYamlValue subtypes and verify WriteJson coverage\n# (run only if you are editing the source generator internals)\nsubprocess.run(['grep', '-rn', 'class SimpleYaml', 'src/Humanizer.SourceGenerators/'])","typeGuard":null,"tryCatchPattern":null,"preventionTips":["If you add a new SimpleYamlValue subtype, immediately add the corresponding case in WriteJson.","Locale authors cannot trigger this through YAML — if it fires, file a generator bug report with the reproducing locale file.","Keep WriteJson's switch exhaustive by treating default as a compile-time error via analyzers where possible."],"tags":["locale","source-generator","internal","json","serializer"],"backgroundTag":null,"analyzedSha":"ffc2b77c0f30d2fb176875841424379319d0ae9b","analyzedAt":"2026-08-13T21:42:34.584Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}