{"record":{"id":"a741d9f5ca221eba","repo":"JosefNemec/Playnite","slug":"property-gettype-property-type-is-not-supporte","errorCode":null,"errorMessage":"{property.GetType()} property type is not supported in this collection.","messagePattern":"(.+?) property type is not supported in this collection\\.","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"source/Playnite/Database/Collections/ItemCollection.cs","lineNumber":270,"sourceCode":"        {\r\n            if (property is MetadataNameProperty nameProp)\r\n            {\r\n                var existingItem = this.FirstOrDefault(a => GameFieldComparer.StringEquals(a.Name, nameProp.Name));\r\n                if (existingItem != null)\r\n                {\r\n                    return existingItem;\r\n                }\r\n                else\r\n                {\r\n                    return typeof(TItem).CrateInstance<TItem>(nameProp.Name);\r\n                }\r\n            }\r\n            else if (property is MetadataIdProperty idProp)\r\n            {\r\n                return this[idProp.Id];\r\n            }\r\n\r\n            throw new NotSupportedException($\"{property.GetType()} property type is not supported in this collection.\");\r\n        }\r\n\r\n        public virtual IEnumerable<TItem> GetOrGenerate(IEnumerable<MetadataProperty> properties)\r\n        {\r\n            var res = new List<TItem>();\r\n            foreach (var property in properties)\r\n            {\r\n                res.Add(GetOrGenerate(property));\r\n            }\r\n\r\n            return res;\r\n        }\r\n\r\n        public virtual TItem Add(MetadataProperty property)\r\n        {\r\n            if (property is MetadataNameProperty nameProp)\r\n            {\r\n                return Add(nameProp.Name, GameFieldComparer.FieldEquals);\r","sourceCodeStart":252,"sourceCodeEnd":288,"githubUrl":"https://github.com/JosefNemec/Playnite/blob/5911f4e964e628aa7a69c2030ab35101afa63067/source/Playnite/Database/Collections/ItemCollection.cs#L252-L288","documentation":"Thrown as NotSupportedException by ItemCollection<TItem>.GetOrGenerate(MetadataProperty) when the provided MetadataProperty is neither a MetadataNameProperty nor a MetadataIdProperty. The collection only knows how to resolve items by name (creating a new instance if not found) or by database ID. Any other MetadataProperty subtype is unsupported.","triggerScenarios":"A metadata plugin or import process passes a custom MetadataProperty subclass to GetOrGenerate. The SDK was extended with new MetadataProperty types but the collection was not updated. A serialized MetadataProperty deserialized into an unexpected concrete type.","commonSituations":"A third-party metadata provider returns a proprietary MetadataProperty subclass. A plugin SDK version mismatch where newer property types are passed to an older collection implementation. Incorrect serialization/deserialization that loses the concrete type information.","solutions":["Ensure all MetadataProperty instances passed to GetOrGenerate are either MetadataNameProperty or MetadataIdProperty.","If using a custom MetadataProperty type, convert it to MetadataNameProperty before calling GetOrGenerate.","Update Playnite to the latest version if the SDK introduced new property types that should be supported.","Add a pre-check: if (property is not MetadataNameProperty and not MetadataIdProperty) convert or skip."],"exampleFix":"// before — passing an unsupported property type\nvar item = collection.GetOrGenerate(myCustomProperty);\n\n// after — normalize to a supported type before calling\nMetadataProperty normalized = myCustomProperty switch\n{\n    MetadataNameProperty np => np,\n    MetadataIdProperty ip => ip,\n    _ => new MetadataNameProperty(myCustomProperty.ToString())\n};\nvar item = collection.GetOrGenerate(normalized);","handlingStrategy":"type-guard","validationCode":"if (property is not MetadataNameProperty and not MetadataIdProperty)\n{\n    logger.Warn($\"Unsupported property type {property.GetType()} for GetOrGenerate.\");\n    property = new MetadataNameProperty(property.ToString());\n}","typeGuard":"static bool IsSupportedMetadataProperty(MetadataProperty property)\n{\n    return property is MetadataNameProperty or MetadataIdProperty;\n}","tryCatchPattern":null,"preventionTips":["Filter metadata properties through a normalization step before calling GetOrGenerate.","When building a metadata plugin, only emit MetadataNameProperty or MetadataIdProperty.","Keep SDK and runtime versions aligned to avoid introducing unknown property types."],"tags":["metadata","item-collection","not-supported","metadata-property","database"],"backgroundTag":null,"analyzedSha":"5911f4e964e628aa7a69c2030ab35101afa63067","analyzedAt":"2026-08-13T17:38:25.713Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}