kestra-io/kestra · error · PebbleException
The argument 'regex' is required.
Error message
The argument 'regex' is required.
What it means
Thrown by the 'regexExtract' Pebble filter when the required `regex` argument is null or absent. The filter declares `regex` (and optional `group`) as named arguments and rejects calls that omit the pattern before attempting compilation.
Source
Thrown at core/src/main/java/io/kestra/core/runners/pebble/filters/RegexExtractFilter.java:57
private static final String ARGUMENT_REGEX = "regex";
private static final String ARGUMENT_GROUP = "group";
private static final List<String> ARGS = List.of(ARGUMENT_REGEX, ARGUMENT_GROUP);
@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 null;
}
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();
int group = args.containsKey(ARGUMENT_GROUP) && args.get(ARGUMENT_GROUP) != null
? ((Number) args.get(ARGUMENT_GROUP)).intValue()
: 0;
if (group < 0) {
throw new PebbleException(
null,
MessageFormat.format("Group index {0} is out of bounds: must be >= 0.", group),
lineNumber,
self.getName()View on GitHub (pinned to 823fada927)
Solutions
- Supply the named argument: `{{ s | regexExtract(regex="\\d+") }}`.
- If regex comes from an input, ensure the input is declared and provided, or default it: `regex=inputs.pattern ?? "\\d+"`.
- Use raw-string-style escaping consistently (Pebble requires `\\d` for `\d`).
Example fix
# before
{{ "order-12345" | regexExtract }}
# after
{{ "order-12345" | regexExtract(regex="\\d+") }} Defensive patterns
Strategy: validation
Validate before calling
# Supply regex, optionally defaulted from an input:
{{ s | regexExtract(regex=inputs.pattern ?? "\\d+") }} Type guard
{% if inputs.pattern is not null %}
{{ s | regexExtract(regex=inputs.pattern) }}
{% endif %} Prevention
- Always pass `regex` as a named argument.
- Declare and validate inputs used as patterns before the flow runs.
- Double-escape backslashes in Pebble regex literals.
When it happens
Trigger: Writing `{{ s | regexExtract }}` or `{{ s | regexExtract(group=1) }}` without supplying `regex`; passing a variable for regex that resolved to null (e.g. an unset input).
Common situations: Referencing an undefined input as the pattern: `regexExtract(regex=inputs.missing)`; copy-paste from a regex literal that lost its quotes; refactoring that drops the argument.
Related errors
- Group index {0} is out of bounds: must be >= 0.
- Group index {0} is out of bounds: the pattern has only {1} c
- The argument 'regex' is required.
- The argument ''{0}'' is required.
- The 'jq' filter expects an argument 'expression'.
AI-assisted analysis of kestra-io/kestra@823fada927 (2026-08-14).
Data as JSON: /api/errors/852d88243e898ace.
Report an issue: GitHub.