Errors

DSAR-PS-1004: PERSISTENCE_INVALID_RECORD

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

  1. Inspect error.trace.entity and error.trace.field for the offending record.
  2. Verify the stored value against the current domain schema.
  3. Run a data migration to correct invalid records.
  4. If error.trace.entity or error.trace.field is 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.
  5. 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.
  6. 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.