{"record":{"id":"369693535b29c709","repo":"tui-cs/Terminal.Gui","slug":"propertyname-unknown-attribute-property","errorCode":null,"errorMessage":"{propertyName}: Unknown Attribute property .","messagePattern":"(.+?): Unknown Attribute property \\.","errorType":"exception","errorClass":"JsonException","httpStatus":null,"severity":"error","filePath":"Terminal.Gui/Configuration/AttributeJsonConverter.cs","lineNumber":99,"sourceCode":"                    case \"style\":\n                        if (reader.TokenType != JsonTokenType.String)\n                        {\n                            throw new JsonException ($\"{propertyName}: Expected a string value.\");\n                        }\n\n                        try\n                        {\n                            style = Enum.Parse<TextStyle> (reader.GetString ()!, ignoreCase: true);\n                        }\n                        catch (ArgumentException ex)\n                        {\n                            throw new JsonException (\"Expected a valid text style value.\", ex);\n                        }\n\n                        break;\n\n                    default:\n                        throw new JsonException ($\"{propertyName}: Unknown Attribute property .\");\n                }\n            }\n            catch (JsonException ex)\n            {\n                throw new JsonException ($\"{propertyName}: \\\"{property}\\\" - {ex.Message}\");\n            }\n        }\n\n        throw new JsonException ($\"{propertyName}: Bad Attribute.\");\n    }\n\n    public override void Write (Utf8JsonWriter writer, Attribute value, JsonSerializerOptions options)\n    {\n        writer.WriteStartObject ();\n        writer.WritePropertyName (nameof (Attribute.Foreground));\n        ColorJsonConverter.Instance.Write (writer, value.Foreground, options);\n        writer.WritePropertyName (nameof (Attribute.Background));\n        ColorJsonConverter.Instance.Write (writer, value.Background, options);","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/tui-cs/Terminal.Gui/blob/2e47b11478db083499917f2ad27c34d30efb0df1/Terminal.Gui/Configuration/AttributeJsonConverter.cs#L81-L117","documentation":"Thrown by the default case of AttributeJsonConverter.Read's switch: the JSON property name is not \"foreground\", \"background\", or \"style\" (compared case-insensitively). Attribute objects only accept those three keys. Note the trailing space + period in the message is a literal formatting quirk in the source.","triggerScenarios":"A config Attribute contains a key like \"Color\", \"Fg\", \"Bg\", \"Text\", \"Width\", or any unrecognized property.","commonSituations":"Using an abbreviation instead of the full name; carrying over a property name from v1 or another theming system; typo (\"Forground\").","solutions":["Rename the key to one of: Foreground, Background, Style (case-insensitive).","Remove the unrecognized key if it is not needed.","Check the AttributeJsonConverter.Write output to see the canonical key names the library itself emits."],"exampleFix":"// before\n{ \"Fg\": \"Red\", \"Bg\": \"Black\" }\n// after\n{ \"Foreground\": \"Red\", \"Background\": \"Black\" }","handlingStrategy":"validation","validationCode":"static readonly HashSet<string> _attrKeys = new (StringComparer.OrdinalIgnoreCase) { \"foreground\", \"background\", \"style\" };\nforeach (var p in attr.EnumerateObject ())\n    if (!_attrKeys.Contains (p.Name))\n        throw new InvalidOperationException ($\"Unknown Attribute key: {p.Name}\");","typeGuard":"static bool IsKnownAttributeKey (string key) =>\n    key.Equals (\"foreground\", StringComparison.OrdinalIgnoreCase)\n    || key.Equals (\"background\", StringComparison.OrdinalIgnoreCase)\n    || key.Equals (\"style\", StringComparison.OrdinalIgnoreCase);","tryCatchPattern":"try { ConfigurationManager.Apply (); }\ncatch (JsonException ex) when (ex.Message.Contains (\"Unknown Attribute property\"))\n{ /* remove/rename the unknown key */ }","preventionTips":["Keep an allow-list of Attribute keys in any config editor you ship.","Serialize a sample Attribute to learn the canonical keys."],"tags":["configuration","json","theming","attribute"],"backgroundTag":null,"analyzedSha":"2e47b11478db083499917f2ad27c34d30efb0df1","analyzedAt":"2026-08-13T19:20:08.826Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}