kestra-io/kestra · error · PebbleException

The argument 'regex' is required.

Error message

The argument 'regex' is required.

What it means

Thrown by the 'regexMatch' Pebble filter when the required `regex` argument is null or missing. The filter uses `find()` semantics (partial match) and needs a pattern before it can compile and evaluate.

Source

Thrown at core/src/main/java/io/kestra/core/runners/pebble/filters/RegexMatchFilter.java:52

    public static final String NAME = "regexMatch";

    private static final String ARGUMENT_REGEX = "regex";

    private static final List<String> ARGS = List.of(ARGUMENT_REGEX);

    @Override
    public List<String> getArgumentNames() {
        return ARGS;
    }

    @Override
    public Object apply(Object input, Map<String, Object> args, PebbleTemplate self, EvaluationContext context, int lineNumber) throws PebbleException {
        if (input == null) {
            return false;
        }

        if (args.get(ARGUMENT_REGEX) == null) {
            throw new PebbleException(
                null,
                MessageFormat.format("The argument ''{0}'' is required.", ARGUMENT_REGEX),
                lineNumber,
                self.getName()
            );
        }

        String regex = args.get(ARGUMENT_REGEX).toString();
        try {
            return RegexUtils.matcher(Pattern.compile(regex), input.toString()).find();
        } catch (PatternSyntaxException e) {
            throw new PebbleException(e, MessageFormat.format("Invalid regex ''{0}'': {1}", regex, e.getDescription()), lineNumber, self.getName());
        } catch (RegexUtils.RegexTimeoutException e) {
            throw new PebbleException(e, e.getMessage(), lineNumber, self.getName());
        }
    }
}

View on GitHub (pinned to 823fada927)

Solutions

  1. Supply the named argument: `{{ s | regexMatch(regex="^abc") }}`.
  2. If the pattern is dynamic, default it: `regex=inputs.pattern ?? ".*"`.
  3. Remember this filter does partial match (find), not full match.

Example fix

# before
{{ email | regexMatch }}
# after
{{ email | regexMatch(regex="^[^@]+@[^@]+\\.[^@]+$") }}
Defensive patterns

Strategy: validation

Validate before calling

# Always supply the regex argument:
{{ s | regexMatch(regex=inputs.pattern ?? ".*") }}

Type guard

{% if inputs.pattern is not null %}
  {{ s | regexMatch(regex=inputs.pattern) }}
{% endif %}

Prevention

When it happens

Trigger: Writing `{{ s | regexMatch }}` without arguments; passing a variable for the regex that resolved to null; misspelling the argument (e.g. `pattern=` instead of `regex=`).

Common situations: Refactoring a flow and dropping the regex argument; referencing an unset input as the pattern; copy-paste errors.

Related errors


AI-assisted analysis of kestra-io/kestra@823fada927 (2026-08-14). Data as JSON: /api/errors/714cf4de86433f77. Report an issue: GitHub.