The problem makes sense. The use of the ":matches" match type with "${1}" used in the if block hints that the "variables" extension is supposed to be used. However, it is not listed in the require line. In that case any variables substitution is ignored, causing the error you're seeing.
Thanks for the explanation.
If this is what RoundCube outputs, there's something wrong with RoundCube.
Yes, I tried adding a new rule via the managesieve’s Roundcube plugin and here’s a comparison with a backup taken just before: root@server:/var/mail/vhosts/example.com/ludovic/sieve# diff -u roundcube.sieve.bak roundcube.sieve --- roundcube.sieve.bak 2018-01-02 20:38:36.191983062 +0100 +++ roundcube.sieve 2018-01-02 20:40:03.457553541 +0100 @@ -1,4 +1,4 @@ -require ["envelope","fileinto","subaddress","variables","mailbox"]; +require ["envelope","fileinto","imap4flags","subaddress"]; if header :contains "X-Spam-Flag" "YES" { fileinto "Junk"; @@ -14,3 +14,9 @@ fileinto "INBOX/pattern"; stop; } +# rule:[dmarc] [...] The require ‘array’ was completely rewritten… I’ll look at Roundcube documentation if this an expected behaviour. Regards, — Ludovic