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
- Supply the named argument: `{{ s | regexMatch(regex="^abc") }}`.
- If the pattern is dynamic, default it: `regex=inputs.pattern ?? ".*"`.
- 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
- Always pass `regex` as a named argument to regexMatch.
- Remember regexMatch uses partial match (find), not full match.
- Default dynamic patterns to a safe value like `.*`.
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
- The argument 'regex' is required.
- The argument ''{0}'' is required.
- The 'jq' filter expects an argument 'expression'.
- Group index {0} is out of bounds: must be >= 0.
- Group index {0} is out of bounds: the pattern has only {1} c
AI-assisted analysis of kestra-io/kestra@823fada927 (2026-08-14).
Data as JSON: /api/errors/714cf4de86433f77.
Report an issue: GitHub.