/
/
Error when creating a filter rule: "error: expecting ',' or end of string list ']' but found unknown characters"

Error when creating a filter rule: "error: expecting ',' or end of string list ']' but found unknown characters"

Symptoms

The filter rules you have set are not working.

The log file ".dovecot.sieve.log" for a particular mailbox contains errors like this:

<rules_name>: line <line_number>: error: unexpected character(s) starting with 0xd0.

<rules_name>: line <line_number>: error: expecting ',' or end of string list ']', but found unknown characters.

Causes

There are quotation marks in the text of the rule, which are treated as control characters by the filter.

Solution

In the filter rules, quotes must be escaped with a backslash: \.

For example, you have created a condition where the filter checks the email subject against the text:

Registration with “Company” LLC

 

To avoid errors, you should modify the text of the condition by placing an escape character before each of the quotation marks:

Registration with \"Company\" LLC

 

In this article