{"record":{"id":"23635e07bfce5820","repo":"tui-cs/Terminal.Gui","slug":"after-propertyname-invalid-json","errorCode":null,"errorMessage":"After {propertyName}: Invalid Json.","messagePattern":"After (.+?): Invalid Json\\.","errorType":"exception","errorClass":"JsonException","httpStatus":null,"severity":"error","filePath":"Terminal.Gui/Configuration/SchemeJsonConverter.cs","lineNumber":79,"sourceCode":"                    \"codenumber\" => scheme with { CodeNumber = attribute },\n                    \"codeoperator\" => scheme with { CodeOperator = attribute },\n                    \"codetype\" => scheme with { CodeType = attribute },\n                    \"codepreprocessor\" => scheme with { CodePreprocessor = attribute },\n                    \"codeidentifier\" => scheme with { CodeIdentifier = attribute },\n                    \"codeconstant\" => scheme with { CodeConstant = attribute },\n                    \"codepunctuation\" => scheme with { CodePunctuation = attribute },\n                    \"codefunctionname\" => scheme with { CodeFunctionName = attribute },\n                    \"codeattribute\" => scheme with { CodeAttribute = attribute },\n                    _ => throw new JsonException ($\"{propertyName}: Unrecognized Scheme Attribute name.\")\n                };\n            }\n            else\n            {\n                throw new JsonException (\"null property name.\");\n            }\n        }\n\n        throw new JsonException ($\"After {propertyName}: Invalid Json.\");\n    }\n\n    /// <inheritdoc/>\n    public override void Write (Utf8JsonWriter writer, Scheme value, JsonSerializerOptions options)\n    {\n        writer.WriteStartObject ();\n\n        foreach (VisualRole role in Enum.GetValues<VisualRole> ())\n        {\n            // Get the attribute for the role\n\n            if (!value.TryGetExplicitlySetAttributeForRole (role, out Attribute? attribute))\n            {\n                // Skip attributes that are not explicitly set\n                continue;\n            }\n            writer.WritePropertyName (role.ToString ());\n            // Write the attribute using the AttributeJsonConverter","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/tui-cs/Terminal.Gui/blob/2e47b11478db083499917f2ad27c34d30efb0df1/Terminal.Gui/Configuration/SchemeJsonConverter.cs#L61-L97","documentation":"The read loop exited (reader.Read returned false) without ever hitting an EndObject token — the JSON object for the Scheme was truncated or never closed. The converter falls through the while loop and throws.","triggerScenarios":"A Scheme object missing its closing brace, e.g. { \"Normal\": {...} (no matching }), or a truncated file cut off mid-object.","commonSituations":"Truncated config file (disk full, copy-paste cut off); missing closing brace from hand-editing.","solutions":["Add the missing closing brace(s) for the Scheme object.","Validate the JSON is complete and balanced."],"exampleFix":"// before\n{ \"Normal\": { \"Foreground\": \"White\" }\n// after\n{ \"Normal\": { \"Foreground\": \"White\" } }","handlingStrategy":"validation","validationCode":"// Confirm the whole document is complete and balanced\ntry { using var doc = JsonDocument.Parse (File.ReadAllText (path)); }\ncatch (JsonException ex) { /* truncated; ex has byte position */ }","typeGuard":null,"tryCatchPattern":"try { ConfigurationManager.Apply (); }\ncatch (JsonException ex) when (ex.Message.Contains (\"Invalid Json\"))\n{ /* likely a missing closing brace; ex.Message names last propertyName */ }","preventionTips":["Validate JSON completeness before loading.","Use an editor that highlights unmatched braces."],"tags":["config","json","scheme","syntax"],"backgroundTag":null,"analyzedSha":"2e47b11478db083499917f2ad27c34d30efb0df1","analyzedAt":"2026-08-13T19:20:08.826Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}