{"record":{"id":"5076df9b74f2545c","repo":"spectreconsole/spectre.console","slug":"emoji-has-null-label","errorCode":null,"errorMessage":"Emoji has null label","messagePattern":"Emoji has null label","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/Spectre.Console.SourceGenerator/Emojis/EmojiModel.cs","lineNumber":38,"sourceCode":"\n/// <summary>\n/// Parses emoji data from JSON.\n/// </summary>\ninternal static class EmojiParser\n{\n    /// <summary>\n    /// Parses the emoji.json file and returns all emoji models.\n    /// Filters out emojis with multiple codepoints (combinators).\n    /// </summary>\n    public static EquatableArray<EmojiModel> ParseAll(string json)\n    {\n        var document = JsonDocument.Parse(json);\n        var emojis = new List<EmojiModel>();\n\n        foreach (var element in document.RootElement.EnumerateArray())\n        {\n            var label = element.GetProperty(\"label\").GetString()\n                ?? throw new InvalidOperationException(\"Emoji has null label\");\n            var hexcode = element.GetProperty(\"hexcode\").GetString()\n                ?? throw new InvalidOperationException(\"Emoji has null hexcode\");\n            var emoji = element.GetProperty(\"emoji\").GetString()\n                ?? throw new InvalidOperationException(\"Emoji has null emoji\");\n\n            // Skip anything that is not a single code point for now\n            if (hexcode.Contains(\"-\"))\n            {\n                continue;\n            }\n\n            // Transform hexcode to Unicode escape sequence\n            var code = TransformToUnicode(hexcode);\n\n            // If the emoji does not have the Emoji_Presentation=Yes property,\n            // then it doesn't have a Variation Selector-16 suffix, and we should add it.\n            var codepoint = int.Parse(hexcode, NumberStyles.HexNumber, CultureInfo.InvariantCulture);\n            if (!HasEmojiPresentation(codepoint))","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/spectreconsole/spectre.console/blob/0acc92fada6c42f13984e79c2b5f3d993bdfb099/src/Spectre.Console.SourceGenerator/Emojis/EmojiModel.cs#L20-L56","documentation":"Thrown by EmojiModel.ParseAll while reading emoji.json: an array element had no usable label string (GetProperty(\"label\").GetString() returned null). Each emoji must have a label, so this is treated as malformed data and parsing stops.","triggerScenarios":"An emoji.json element contains \"label\": null or otherwise yields a null string for the label property.","commonSituations":"Hand-editing or forking emoji.json with a null label; truncated download of the emoji data; schema drift.","solutions":["Find the offending element (it will be the next one parsed) and give it a non-null label","Restore emoji.json from the Spectre.Console package","Validate the JSON structure before replacing the bundled file"],"exampleFix":"// before\n{ \"label\": null, \"hexcode\": \"1F600\", \"emoji\": \"\\ud83d\\ude00\" }\n// after\n{ \"label\": \"grinning face\", \"hexcode\": \"1F600\", \"emoji\": \"\\ud83d\\ude00\" }","handlingStrategy":"validation","validationCode":"// Scan emoji.json for null labels before replacing the file\nusing var doc = JsonDocument.Parse(File.ReadAllText(\"emoji.json\"));\nforeach (var e in doc.RootElement.EnumerateArray())\n    if (e.GetProperty(\"label\").ValueKind == JsonValueKind.Null)\n        Console.Error.WriteLine(\"emoji has null label\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate edited emoji.json before shipping","Keep the bundled data; restore from the package if unsure"],"tags":["json","source-generator","data-integrity","emoji"],"backgroundTag":null,"analyzedSha":"0acc92fada6c42f13984e79c2b5f3d993bdfb099","analyzedAt":"2026-08-13T18:27:21.983Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}