Skip to content
Deedboxlatest

DBX039: Polymorphic JSON cannot be read back on this database

This page explains error DBX039 and how to fix it.

An event or state type holds a polymorphic member, such as a base type with [JsonDerivedType], or the JSON options set a ReferenceHandler. Their JSON starts with a metadata property such as $type. Postgres jsonb stores object keys in its own order, and System.Text.Json on .NET 8 reads a metadata property only when it is the first key. Without this check, the event appends and every later load of the stream fails.

Target .NET 9 or later; Deedbox then reads metadata properties in any position. Or remove the polymorphic member: store a plain property that names the kind, and choose the type in your own code.