If you've attempted to send more than 20 objectIDs in a single view event via the viewedObjectIDs, you will the 422 Error: "Cannot process more than 20 objects in an event".
This error is warning you of the limitations of the viewedObjectIDs parameter which can only take 20 objectIDs in a single event. This can happen when you have more than 20 hitsPerPage.
The solution is to send these objectIDs in multiple batches (i.e. more than one event). For example, if you have 40 hitsPerPage, you should send two events with 20 objectIDs each. Please reference the Send Events documentation when doing so.
InstantSearch's Insight's middleware and AutoComplete's Insights Plugin automatically handle this batching, so no further work is needed if you use either of these libraries.
Please note that these features are available on the latest versions of InstantSearch and Autocomplete. If you encounter this error with either library, please update to the latest version.