Unexpected warnings in AbstractSnapshotter

We have been observing some random warnings from AbstractSnapshotter class off recently, after we implemented some caching in our event store implemented.
While we don’t see functional impacts for this, we do see quite many errors like this.

ERROR 19404 — [DisruptorCommandBus-11] o.a.e.AbstractSnapshotter : An attempt to create and store a snapshot resulted in an exception.Exception summary: null

while the exception trace is not printed, after some workaround, following is some additional information i have

2023-12-19 19:07:22.890 ERROR 19404 — [DisruptorCommandBus-11] o.a.e.AbstractSnapshotter : An attempt to create and store a snapshot resulted in an exception.Exception summary: null

org.axonframework.eventsourcing.IncompatibleAggregateException: Aggregate identifier must be non-null after applying an event. Make sure the aggregate identifier is initialized at the latest when handling the creation event.
at org.axonframework.eventsourcing.EventSourcedAggregate.publish(EventSourcedAggregate.java:160) ~[axon-core-3.1.jar!/:3.1]
at java.util.Iterator.forEachRemaining(Iterator.java:116) ~[?:1.8.0_372]
at org.axonframework.eventsourcing.EventSourcedAggregate.lambda$initializeState$1(EventSourcedAggregate.java:212) ~[axon-core-3.1.jar!/:3.1]
at org.axonframework.commandhandling.model.inspection.AnnotatedAggregate.lambda$execute$2(AnnotatedAggregate.java:174) ~[axon-core-3.1.jar!/:3.1]
at org.axonframework.commandhandling.model.AggregateLifecycle.lambda$execute$3(AggregateLifecycle.java:199) ~[axon-core-3.1.jar!/:3.1]
at org.axonframework.commandhandling.model.AggregateLifecycle.executeWithResult(AggregateLifecycle.java:166) ~[axon-core-3.1.jar!/:3.1]
at org.axonframework.commandhandling.model.AggregateLifecycle.execute(AggregateLifecycle.java:198) ~[axon-core-3.1.jar!/:3.1]
at org.axonframework.commandhandling.model.inspection.AnnotatedAggregate.execute(AnnotatedAggregate.java:174) ~[axon-core-3.1.jar!/:3.1]
at org.axonframework.eventsourcing.EventSourcedAggregate.initializeState(EventSourcedAggregate.java:209) ~[axon-core-3.1.jar!/:3.1]
at org.axonframework.eventsourcing.AggregateSnapshotter.createSnapshot(AggregateSnapshotter.java:126) ~[axon-core-3.1.jar!/:3.1]
at org.axonframework.eventsourcing.AbstractSnapshotter$CreateSnapshotTask.run(AbstractSnapshotter.java:173) ~[axon-shared-develop-984-SNAPSHOT.jar!/:3.1

Request any useful inputs or advice from axon experts.

Do you have a test that serializes and deserializes the aggregate? I assume something is going wrong there, where the aggregate identifier especially is missing in the serialized form. If you are using Jackson, and assuming the identifier is private, you need to annotate it or change the Objectconverter configuration. This Baeldung article might help if those assumptions are correct.

these aggregates are in use for many years and the id attributes for them didnt change at all. While we see plenty of these errors, we don’t see similar functional impacts.

Thanks Gerard for the quick response!

a few more inputs further to this after more debugging at our end. We can see the snapshot was not taken and persisted in this case. Do note, our aggregate is simple pojo class with the @AggregateIdentifier attribute on the id field.
I can also confirm, the call to storeSnapshot(…) also didnt happen ever, as our try catch there was never activated. So this failure happened in axon layer itself and not in our event store implementation.
We are using 3.1 version of axon.

Would appreciate any inputs or insights you could share.


But without snapshotting, you don’t have this error?

I do want to point out 3.1 is a pretty old version of Axon Framework by current standards.
At the very least, you should be able to go to latest stable release of Axon Framework 3, which is 3.4.4.