kestra-io/kestra · error · PebbleException

The 'substringAfter' filter expects an argument 'separator'.

Error message

The 'substringAfter' filter expects an argument 'separator'.

What it means

The 'substringAfter' Pebble filter returns the portion of a string that comes AFTER the first occurrence of a separator (delegating to Apache Commons StringUtils.substringAfter). The filter registers 'separator' as a required named argument and throws when apply() is invoked with no 'separator' entry in args. This is a template-authoring error: the filter was applied without its argument.

Source

Thrown at core/src/main/java/io/kestra/core/runners/pebble/filters/SubstringAfterFilter.java:33

    private final List<String> argumentNames = new ArrayList<>();

    public SubstringAfterFilter() {
        this.argumentNames.add("separator");
    }

    @Override
    public List<String> getArgumentNames() {
        return this.argumentNames;
    }

    @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.containsKey("separator")) {
            throw new PebbleException(null, "The 'substringAfter' filter expects an argument 'separator'.", lineNumber, self.getName());
        }

        String separator = (String) args.get("separator");
        ;

        return StringUtils.substringAfter(input.toString(), separator);
    }
}

View on GitHub (pinned to 823fada927)

Solutions

  1. Add the separator argument: {{ myVar | substringAfter(separator="-") }}.
  2. If the separator comes from a variable, ensure that variable is defined and non-null before the filter runs (guard with a default: {{ myVar | substringAfter(separator=mySep ?? "-") }}).
  3. Confirm the filter name spelling matches the installed Kestra version; older/newer versions may differ.

Example fix

// before
{{ outputs.url | substringAfter }}
// after
{{ outputs.url | substringAfter(separator="/") }}
Defensive patterns

Strategy: validation

Validate before calling

// Pebble: ensure separator is bound before applying
{{ myVar is empty ? '' : myVar | substringAfter(separator=(mySep ?? "-")) }}

Prevention

When it happens

Trigger: Writing a Pebble expression as {{ myVar | substringAfter }} instead of {{ myVar | substringAfter(separator="-") }} (or the positional form {{ myVar | substringAfter("-") }}). Also occurs if the separator expression evaluates to an absent variable so Pebble never binds the named argument.

Common situations: Copying a filter name from docs but omitting the separator; passing a separator that resolves to null via an undefined output (e.g. separator=outputs.missing.value); refactoring a template and renaming the variable that feeds separator.

Related errors


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