Error Message: key cartesian product size {} is greater than maximum {}

I’m seeing this error while reading data from ScyllaDB RequestHandler: ip:9042 replied with server error (clustering key cartesian product size 600 is greater than maximum 100), defuncting connection.
Any idea?

*Based on a question originally asked on Stack Overflow by rohan-vadje

This error is returned to prevent too large restriction sets from being generated, which may put a strain on your server. If you’re aware of the risks and know a reasonable upper bound of the number of restrictions for your queries, you can manually change the maximum in scylla.yaml, e.g. max_clustering_key_restrictions_per_query: 650. Note, however, that this option has a warning in its description, and it should be acknowledged:

Maximum number of distinct clustering key restrictions per query.
This limit places a bound on the size of IN tuples, especially when multiple
clustering key columns have IN restrictions. Increasing this value can result
in server instability.

In particular, setting this flag above a couple of hundred is risky - 600 should be alright, but at this point, you could also consider rephrasing your query so that they have less values in their IN restrictions - perhaps splitting some queries into multiple smaller ones?

Source from Scylla tracker: https://github.com/scylladb/scylla/pull/4797

*Based on an answer originally on Stack Overflow by Piotr Sarna