DIYgod/RSSHub · error

Invalid Engine Value: ${engine}, please check your config.

Error message

Invalid Engine Value: ${engine}, please check your config.

What it means

Thrown by the filter feature in the parameter middleware when config.feature.filter_regex_engine is neither 'regexp' nor 're2'. The engine selects how the `filter` / `filterout` / `filter_title` query params are compiled; any other value (including typos, empty string, or unset-but-not-defaulted in a misconfigured build) hits the default branch.

Source

Thrown at lib/middleware/parameter.ts:194

                item.category = item.category.filter((e) => typeof e === 'string');
            }
            return item;
        };

        data.item = await Promise.all(data.item.map((itm) => handleItem(itm)));

        // filter
        const engine = config.feature.filter_regex_engine;
        const makeRegex = (str: string) => {
            // default: case_senstivie = true
            const insensitive = ctx.req.query('filter_case_sensitive') === 'false';
            switch (engine) {
                case 'regexp':
                    return new RegExp(str, insensitive ? 'i' : '');
                case 're2':
                    return RE2JS.compile(str, insensitive ? RE2JS.CASE_INSENSITIVE : 0);
                default:
                    throw new Error(`Invalid Engine Value: ${engine}, please check your config.`);
            }
        };

        if (ctx.req.query('filter')) {
            const regex = makeRegex(ctx.req.query('filter')!);

            data.item = data.item.filter((item) => {
                const title = item.title || '';
                const description = item.description || title;
                const author = getAuthorString(item);
                const category = (item.category as string[] | undefined) || [];
                const isFilter =
                    regex instanceof RE2JS
                        ? regex.matcher(title).find() || regex.matcher(description).find() || regex.matcher(author).find() || category.some((c) => regex.matcher(c).find())
                        : title.match(regex) || description.match(regex) || author.match(regex) || category.some((c) => c.match(regex));

                return isFilter;
            });

View on GitHub (pinned to bed535e087)

Solutions

  1. Set FILTER_REGEX_ENGINE to either 'regexp' or 're2' (lowercase) and restart.
  2. If unsure, unset the variable entirely so RSSHub applies its documented default.
  3. Remove the `?filter` family params from the request if filtering is not needed right now.

Example fix

# before
FILTER_REGEX_ENGINE=re2js
# after
FILTER_REGEX_ENGINE=re2
Defensive patterns

Strategy: validation

Validate before calling

const VALID_ENGINES = new Set(['regexp', 're2']);
const engine = process.env.FILTER_REGEX_ENGINE ?? 'regexp';
if (!VALID_ENGINES.has(engine)) {
  throw new Error(`FILTER_REGEX_ENGINE must be 'regexp' or 're2', got '${engine}'`);
}

Type guard

const isFilterEngine = (v: unknown): v is 'regexp' | 're2' =>
  v === 'regexp' || v === 're2';

Prevention

When it happens

Trigger: FILTER_REGEX_ENGINE env is set to an unsupported value (e.g. 're2js', 'pcre', 'regex', '') and a request uses any `?filter...=` query parameter, which invokes makeRegex.

Common situations: Operator copies a config snippet with a wrong engine name; env var left blank explicitly overrides the default; case mismatch ('RE2' vs 're2').

Related errors


AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12). Data as JSON: /api/errors/d3e77dac14e82036. Report an issue: GitHub.