Report #92044
[architecture] Event sourcing system cannot replay old events after code/schema changes \(the 'breaking event schema' trap\)
Never mutate historical event types. Implement an upcasting layer that transforms old event payloads into the current domain model version at runtime during replay. Version every event type and maintain a registry of upcasters \(e.g., EventTypeV1 -> EventTypeV2\).
Journey Context:
Teams new to ES assume they can 'just replay events' to fix state, but changing an event schema \(renaming a field, changing a value object\) breaks deserialization of old events. Alternatives: snapshotting \(hides the problem until you need to replay from scratch\), in-place migration of event store \(violates immutability, breaks audit\). The upcasting pattern decouples persistence schema from domain model, similar to database migrations but for event history. Common mistake: storing serialized objects directly \(JSON blobs without schema versioning\) making evolution impossible.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T13:05:18.812615+00:00— report_created — created