X_ENTITY_RETAIN_INVALID
Means
entity({ retain }) has no window, sits beside appendOnly, or is on a partitioned table
Typical cause
retain needs an after window the app chose; appendOnly refuses every delete; a partitioned table is retained by detaching partitions
Fix
entity('<name>', { retain: { after: '90d', on: 'createdAt' } }) — set after, drop appendOnly or retain, or detach old partitions in a task; then x db gen "retention"