Rspamd, bayes expiry and Redis – ERR Number of keys can’t be greater than number of args
I recently enabled the bayes expiry module (https://rspamd.com/doc/modules/bayes_expiry.html) in Rspamd and found myself staring at the following error in the Rspamd logs with no idea what it meant:
lua; bayes_expiry.lua:332: cannot perform expiry step: ERR Number of keys can’t be greater than number of args
The only reference that I could find to this online was a single post on the Rspamd mailing list, which had gone unanswered (https://groups.google.com/d/msg/rspamd/jFG-MTLzZw8/-8WIIY_ECAAJ).
It turns out that I had the “expire” setting defined twice in /etc/rspamd/local.d/classifier-bayes.conf. After fixing this, restarting Rspamd and waiting a couple of minutes, I started to see the expected log entries from the bayes expiry module executing its expiry processing step every minute:
lua; bayes_expiry.lua:368: finished expiry step 9995 (lazy): 1001 items checked, 163 significant (0 made persistent), 0 insignificant (0 ttls set), 0 common (0 discriminated), 838 infrequent (837 ttls set), 4 mean, 20 std