{"record":{"id":"ea0d6529c247be5c","repo":"tui-cs/Terminal.Gui","slug":"after-propertyname-expected-propertyname-but-go","errorCode":null,"errorMessage":"After {propertyName}: Expected PropertyName but got another token when parsing Attribute: {reader.TokenType}.","messagePattern":"After (.+?): Expected PropertyName but got another token when parsing Attribute: (.+?)\\.","errorType":"exception","errorClass":"JsonException","httpStatus":null,"severity":"error","filePath":"Terminal.Gui/Configuration/SchemeJsonConverter.cs","lineNumber":30,"sourceCode":"    {\n        if (reader.TokenType != JsonTokenType.StartObject)\n        {\n            throw new JsonException ($\"Unexpected StartObject token when parsing Scheme: {reader.TokenType}.\");\n        }\n\n        var scheme = new Scheme ();\n        var propertyName = string.Empty;\n\n        while (reader.Read ())\n        {\n            if (reader.TokenType == JsonTokenType.EndObject)\n            {\n                return scheme;\n            }\n\n            if (reader.TokenType != JsonTokenType.PropertyName)\n            {\n                throw new JsonException ($\"After {propertyName}: Expected PropertyName but got another token when parsing Attribute: {reader.TokenType}.\");\n            }\n\n            propertyName = reader.GetString ();\n            reader.Read ();\n\n            // Make sure attributes are marked as explicitly set when deserialized\n            object? attrObj = JsonSerializer.Deserialize (ref reader, TuiSerializerContext.Instance.Attribute);\n\n            if (attrObj is not Attribute attribute)\n            {\n                throw new JsonException ($\"After {propertyName}: Expected Attribute but got {attrObj?.GetType ().Name ?? \"null\"} when parsing Scheme.\");\n            }\n            if (propertyName is { })\n            {\n                scheme = propertyName.ToLowerInvariant () switch\n                {\n                    \"normal\" => scheme with { Normal = attribute },\n                    \"hotnormal\" => scheme with { HotNormal = attribute },","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/tui-cs/Terminal.Gui/blob/2e47b11478db083499917f2ad27c34d30efb0df1/Terminal.Gui/Configuration/SchemeJsonConverter.cs#L12-L48","documentation":"Inside a Scheme object, after reading a property's Attribute value, the next token is not a PropertyName — meaning the JSON structure is malformed (an extra value, a missing comma, or an unexpected nested token where a flat key:value pair was expected).","triggerScenarios":"A Scheme object like { \"Normal\": {...} \"Focus\": {...} } (missing comma), or { \"Normal\": {...}, [array] }, or a value that consumed the wrong number of tokens.","commonSituations":"Hand-editing JSON and dropping a comma; a templating tool emitting malformed JSON; nested object where a flat key was expected.","solutions":["Run the config JSON through a JSON validator/linter to find the syntax error.","Ensure each Scheme entry is flat key:value pairs separated by commas.","Regenerate the config from a known-good default and re-apply edits."],"exampleFix":"// before\n{ \"Normal\": {\"Foreground\":\"White\"} \"Focus\": {\"Foreground\":\"Yellow\"} }\n// after\n{ \"Normal\": {\"Foreground\":\"White\"}, \"Focus\": {\"Foreground\":\"Yellow\"} }","handlingStrategy":"validation","validationCode":"// Pre-validate JSON syntax before handing to ConfigurationManager\ntry { JsonDocument.Parse (File.ReadAllText (path)); }\ncatch (JsonException ex) { /* report line/position from ex */ }","typeGuard":null,"tryCatchPattern":"try { ConfigurationManager.Apply (); }\ncatch (JsonException ex) when (ex.Message.Contains (\"Expected PropertyName\"))\n{ /* ex.Message names the last good propertyName; locate the missing comma */ }","preventionTips":["Validate JSON syntax (editor linting or `dotnet` JSON tooling) before loading config.","Avoid hand-editing large theme files; use a structured JSON editor."],"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"}