JosefNemec/Playnite · error · Exception
Can't assign object to uknown dat property.
Error message
Can't assign object to uknown dat property.
What it means
Thrown by DatParser when a top-level DAT property name matches a known datGameProperties key, but its value is a nested DatObject rather than a scalar string. Only a few keys (like 'rom') are handled as nested objects; any other key whose value is an object has no target mapping and the parser refuses to guess, raising a generic Exception. Note the misspelling 'uknown' is intentional/consistent with the codebase.
Source
Thrown at source/Tools/Playnite.Utilities/DatParser.cs:94
foreach (var prop in datObj.Properties)
{
var romAdded = false;
if (prop.Name == "rom" && !romAdded)
{
romAdded = true;
foreach (var romDatProp in (prop.Value as DatObject).Properties)
{
if (datGameProperties.TryGetValue("rom." + romDatProp.Name, out var romPropInfo))
{
SetParsedProperty(romPropInfo, datGame, (string)romDatProp.Value);
}
}
}
else if (datGameProperties.TryGetValue(prop.Name, out var propInfo))
{
if (prop.Value is DatObject)
{
throw new Exception("Can't assign object to uknown dat property.");
}
SetParsedProperty(propInfo, datGame, (string)prop.Value);
}
}
datGame.FixData();
return datGame;
}
private void SetParsedProperty(PropertyInfo prop, object datGame, string propValue)
{
if (prop.PropertyType == typeof(uint))
{
prop.SetValue(datGame, uint.Parse(propValue));
}
else if (prop.PropertyType == typeof(int))
{
View on GitHub (pinned to 5911f4e964)
Solutions
- Inspect the offending DAT entry to find which property name carries an object value instead of a string.
- If the nested object is legitimate, add an explicit branch in the parser (mirroring the 'rom' handling) to map its sub-properties before this else-if falls through.
- Pre-process/sanitize the DAT so recognized keys carry scalar values.
- Report the property name upstream so the DAT schema can be corrected.
Example fix
// before
else if (datGameProperties.TryGetValue(prop.Name, out var propInfo))
{
if (prop.Value is DatObject)
throw new Exception("Can't assign object to uknown dat property.");
SetParsedProperty(propInfo, datGame, (string)prop.Value);
}
// after (handle a legitimate nested container explicitly)
else if (prop.Name == "custom" && prop.Value is DatObject custom)
{
foreach (var sub in custom.Properties)
if (datGameProperties.TryGetValue("custom." + sub.Name, out var sp))
SetParsedProperty(sp, datGame, (string)sub.Value);
}
else if (datGameProperties.TryGetValue(prop.Name, out var propInfo))
{
SetParsedProperty(propInfo, datGame, (string)prop.Value);
} Defensive patterns
Strategy: type-guard
Type guard
static bool IsKnownScalarProperty(string name, object value) =>
datGameProperties.ContainsKey(name) && !(value is DatObject);
// guard before assignment:
if (prop.Value is DatObject obj)
logger.Warn($"Skipping nested object on known property '{prop.Name}' — no mapping.");
else
SetParsedProperty(propInfo, datGame, (string)prop.Value); Prevention
- Validate DAT structure against the expected schema before parsing; flag object values on scalar keys.
- Add explicit nested-property branches (like 'rom') for any legitimate container instead of relying on the fallthrough.
- Log the offending property name and parent entry when the shape is unexpected to speed diagnosis.
When it happens
Trigger: Parsing a .dat file whose structure nests an object under a property name that is recognized but not the 'rom' container — i.e. a DAT object whose Name collides with a flat datGame property but whose Value is itself a DatObject.
Common situations: Custom or non-standard DAT exports that nest data unexpectedly; a DAT from a different emulator/curation tool using object values for fields Playnite expects as scalars; schema drift in an upstream DAT generator.
Related errors
AI-assisted analysis of JosefNemec/Playnite@5911f4e964 (2026-08-13).
Data as JSON: /api/errors/02dd3d957ed7e345.
Report an issue: GitHub.