{"record":{"id":"de2876ad8be493a5","repo":"tui-cs/Terminal.Gui","slug":"value-invalid-rune-de2876","errorCode":null,"errorMessage":"{value}: Invalid Rune","messagePattern":"(.+?): Invalid Rune","errorType":"exception","errorClass":"JsonException","httpStatus":null,"severity":"error","filePath":"Terminal.Gui/Configuration/RuneJsonConverter.cs","lineNumber":66,"sourceCode":"                            throw new JsonException ($\"{value}: Invalid Rune.\");\n                        }\n\n                        if (codePoints.Length > 0)\n                        {\n                            first = (int)codePoints [0];\n                        }\n\n                        if (codePoints.Length == 2)\n                        {\n                            second = (int)codePoints [1];\n                        }\n                    }\n                    else\n                    {\n                        // Handle single character, surrogate pair, or combining mark + char\n                        if (value is { Length: 0 or > 2 })\n                        {\n                            throw new JsonException ($\"{value}: Invalid Rune\");\n                        }\n\n                        if (value is { Length: > 0 })\n                        {\n                            first = value [0];\n                        }\n\n                        if (value is { Length: 2 })\n                        {\n                            second = value [1];\n                        }\n                    }\n\n                    Rune result;\n\n                    if (second == RuneExtensions.MaxUnicodeCodePoint + 1)\n                    {\n                        // Single codepoint","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/tui-cs/Terminal.Gui/blob/2e47b11478db083499917f2ad27c34d30efb0df1/Terminal.Gui/Configuration/RuneJsonConverter.cs#L48-L84","documentation":"Thrown by RuneJsonConverter.Read (RuneJsonConverter.cs:64-67) when a Rune string value does NOT start with U+/\\U (so it is treated as a literal glyph) but its length is 0 or greater than 2. A literal Rune glyph must be a single character or a two-character surrogate/combining-mark pair. Empty strings and 3+ character literals are rejected.","triggerScenarios":"A Rune config value is an empty string \"\", or a literal string of 3+ characters that is not in encoded U+ form, e.g. \"abc\". Since it does not start with U+/\\U, the converter treats it as a raw glyph and enforces length 1 or 2.","commonSituations":"User leaves a Rune field empty. User puts a multi-character word (\"yes\") where a single glyph is expected. User pastes a grapheme cluster that the OS decomposed into 3+ chars. Confusion between the literal-glyph form and the U+ encoded form.","solutions":["Provide a single character for the Rune (e.g. \"☑\") or a two-character surrogate/combining-mark pair.","If you have a codepoint, use the encoded form \"U+2611\" instead of a literal.","Do not leave Rune fields empty; supply a default glyph (e.g. space \" \" or the replacement character).","For multi-character sequences, encode each as U+ with at most two codepoints, or reconsider whether a Rune is the right type."],"exampleFix":"// before (empty / too long literal)\n\"Check\": \"\"\n// or\n\"Check\": \"yes\"\n\n// after (single glyph)\n\"Check\": \"☑\"\n// or encoded\n\"Check\": \"U+2611\"","handlingStrategy":"validation","validationCode":"static bool IsValidLiteralRune (string? value)\n{\n    if (value is null) return false;\n    if (value.StartsWith (\"U+\", StringComparison.OrdinalIgnoreCase)\n        || value.StartsWith (\"\\\\U\", StringComparison.OrdinalIgnoreCase))\n        return true; // encoded form, validated elsewhere\n    return value.Length is 1 or 2;\n}\n\nif (!IsValidLiteralRune (runeValue))\n{\n    // supply a single glyph, a surrogate pair, or use U+ encoded form\n}","typeGuard":"static bool IsValidLiteralRune (string? value)\n{\n    if (value is null) return false;\n    if (value.StartsWith (\"U+\", StringComparison.OrdinalIgnoreCase)\n        || value.StartsWith (\"\\\\U\", StringComparison.OrdinalIgnoreCase))\n        return true;\n    return value.Length is 1 or 2;\n}","tryCatchPattern":"try\n{\n    ConfigurationManager.Load (configJson);\n}\ncatch (JsonException ex) when (ex.Message.Contains (\"Invalid Rune\"))\n{\n    // A literal Rune was empty or >2 chars. Supply a single glyph or use U+ form, then reload.\n}","preventionTips":["Provide a single character for literal Rune values (e.g. \"☑\").","Use the U+ encoded form for codepoints: \"U+2611\".","Never leave Rune fields empty; supply a default glyph.","Do not put multi-character words in a Rune field."],"tags":["json","configuration","rune","unicode","serialization"],"backgroundTag":null,"analyzedSha":"2e47b11478db083499917f2ad27c34d30efb0df1","analyzedAt":"2026-08-13T19:20:08.826Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}