Errors
DSAR-PS-1004: PERSISTENCE_INVALID_RECORD
Alpha
DSAR is currently in alpha. APIs, package surfaces, configuration, and documentation may change as the project evolves.
Meaning
A record retrieved from the database violates the expected domain contract (e.g. an enum field contains an unrecognised value).
Probable Causes
- Database was modified directly, bypassing application-level validation.
- A migration introduced or removed valid enum values without updating all records.
- Data corruption or encoding issue in the storage layer.
How to Fix
- Inspect
error.trace.entityanderror.trace.fieldfor the offending record. - Verify the stored value against the current domain schema.
- Run a data migration to correct invalid records.
- If
error.trace.entityorerror.trace.fieldis missing/redacted, identify affected rows using record identifiers (record ID, primary key, and query context), then generate a schema diff between stored values and the current domain schema. - Review migrations and change logs for the relevant deployment window to find when the schema/value divergence began, then run a targeted data migration to fix only invalid records.
- Add diagnostic logging when trace metadata is absent: record ID, attempted field path, schema diff summary, and migration window.
Retryable
No. The underlying data must be corrected first.
Minimal Trigger Example
Reading a record whose status or retentionClass column contains an unrecognised value.