Intermittent Failed to read events from the underlying event storage

I am using JPA Event Store - and now & then I see following error while processing an event -

2023-07-04T14:43:55.888-05:00  WARN 16499 --- [dedEventStore-0] o.h.engine.jdbc.spi.SqlExceptionHelper   : SQL Error: 0, SQLState: 22023
2023-07-04T14:43:55.888-05:00 ERROR 16499 --- [dedEventStore-0] o.h.engine.jdbc.spi.SqlExceptionHelper   : PreparedStatement can have at most 65,535 parameters. Please consider using arrays, or splitting the query in several ones, or using COPY. Given query has 88,853 parameters
2023-07-04T14:43:55.896-05:00 ERROR 16499 --- [dedEventStore-0] o.a.e.eventstore.EmbeddedEventStore      : Failed to read events from the underlying event storage

org.hibernate.exception.DataException: could not prepare statement [PreparedStatement can have at most 65,535 parameters. Please consider using arrays, or splitting the query in several ones, or using COPY. Given query has 88,853 parameters] [select d1_0.global_index,d1_0.type,d1_0.aggregate_identifier,d1_0.sequence_number,d1_0.event_identifier,d1_0.time_stamp,d1_0.payload_type,d1_0.payload_revision,d1_0.payload,d1_0.meta_data from domain_event_entry d1_0 where d1_0.global_index>? or d1_0.global_index in(?

serilization config -

axon:
  serializer:
    general: jackson
    events: jackson
    messages: jackson

This mostly happens after I reset token store / cleanup event store / restart the application. It goes away after a while, though it would be good to know the actual cause to better handle this. Thank you for your time and help.

Hi Deepak,

did you by any chance reset the event store without resetting the sequence?

If that’s not the case, can you please provide us with a minimal reproducible example and details about the DB you use, as well as the full line from your log output?

Kind regards,
Marco

Hi Marco, apolgies for delayed response. I sinply went in & wiped out all axon related tables - restarted application & tried to issue command & process the event. Using spring boot 3 wit axon 4.7. I will try replicating using simple setup & share the repo. For now, I am seeing this behavior for initial command / event - any further command / event processing works just fine & after few restarts app works ok. Thank you