JosefNemec/Playnite · error · NotSupportedException
{property.GetType()} property type is not supported in this
Error message
{property.GetType()} property type is not supported in this collection. What it means
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.
Source
Thrown at source/Playnite/Database/Collections/ItemCollection.cs:270
{
if (property is MetadataNameProperty nameProp)
{
var existingItem = this.FirstOrDefault(a => GameFieldComparer.StringEquals(a.Name, nameProp.Name));
if (existingItem != null)
{
return existingItem;
}
else
{
return typeof(TItem).CrateInstance<TItem>(nameProp.Name);
}
}
else if (property is MetadataIdProperty idProp)
{
return this[idProp.Id];
}
throw new NotSupportedException($"{property.GetType()} property type is not supported in this collection.");
}
public virtual IEnumerable<TItem> GetOrGenerate(IEnumerable<MetadataProperty> properties)
{
var res = new List<TItem>();
foreach (var property in properties)
{
res.Add(GetOrGenerate(property));
}
return res;
}
public virtual TItem Add(MetadataProperty property)
{
if (property is MetadataNameProperty nameProp)
{
return Add(nameProp.Name, GameFieldComparer.FieldEquals);
View on GitHub (pinned to 5911f4e964)
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.
Example fix
// before — passing an unsupported property type
var item = collection.GetOrGenerate(myCustomProperty);
// after — normalize to a supported type before calling
MetadataProperty normalized = myCustomProperty switch
{
MetadataNameProperty np => np,
MetadataIdProperty ip => ip,
_ => new MetadataNameProperty(myCustomProperty.ToString())
};
var item = collection.GetOrGenerate(normalized); Defensive patterns
Strategy: type-guard
Validate before calling
if (property is not MetadataNameProperty and not MetadataIdProperty)
{
logger.Warn($"Unsupported property type {property.GetType()} for GetOrGenerate.");
property = new MetadataNameProperty(property.ToString());
} Type guard
static bool IsSupportedMetadataProperty(MetadataProperty property)
{
return property is MetadataNameProperty or MetadataIdProperty;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Cannot add file to database, file not found.
- Emulator not found.
- BSON type not supported
- Database path cannot be empty.
- Can't write to "{DatabasePath}" folder.
AI-assisted analysis of JosefNemec/Playnite@5911f4e964 (2026-08-13).
Data as JSON: /api/errors/a741d9f5ca221eba.
Report an issue: GitHub.