kestra-io/kestra · error · PebbleException
The argument ''{0}'' is required.
Error message
The argument ''{0}'' is required. What it means
Thrown by the 'regexReplace' Pebble filter when the required `regex` argument is null or missing. The filter needs both a pattern and a replacement; this branch fires first when the pattern is absent.
Source
Thrown at core/src/main/java/io/kestra/core/runners/pebble/filters/RegexReplaceFilter.java:51
private static final String ARGUMENT_REGEX = "regex";
private static final String ARGUMENT_REPLACEMENT = "replacement";
private static final List<String> ARGS = List.of(ARGUMENT_REGEX, ARGUMENT_REPLACEMENT);
@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()
);
}
if (args.get(ARGUMENT_REPLACEMENT) == null) {
throw new PebbleException(
null,
MessageFormat.format("The argument ''{0}'' is required.", ARGUMENT_REPLACEMENT),
lineNumber,
self.getName()
);
}
String regex = args.get(ARGUMENT_REGEX).toString();
String replacement = args.get(ARGUMENT_REPLACEMENT).toString();View on GitHub (pinned to 823fada927)
Solutions
- Supply both named arguments: `{{ s | regexReplace(regex="\\s+", replacement="_") }}`.
- Default dynamic patterns: `regex=inputs.pattern ?? ".*"`.
- Capture groups can be referenced as `$1`, `$2` in the replacement.
Example fix
# before
{{ slug | regexReplace(replacement="-") }}
# after
{{ slug | regexReplace(regex="\\s+", replacement="-") }} Defensive patterns
Strategy: validation
Validate before calling
# Supply both arguments:
{{ s | regexReplace(regex=inputs.pattern ?? ".*", replacement=inputs.repl ?? "") }} Type guard
{% if inputs.pattern is not null %}
{{ s | regexReplace(regex=inputs.pattern, replacement="x") }}
{% endif %} Prevention
- Always pass `regex` and `replacement` as named arguments.
- Capture groups in the replacement use `$1`, `$2`.
- Lint for regexReplace calls missing either argument.
When it happens
Trigger: Calling `{{ s | regexReplace(replacement="x") }}` without `regex`; passing a variable for regex that resolved to null; misspelling the argument name.
Common situations: Refactoring drops the regex argument; referencing an unset input as the pattern; confusing positional vs named arguments.
Related errors
- The argument 'regex' is required.
- The argument 'regex' 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/b4952da26e463e49.
Report an issue: GitHub.