{"record":{"id":"ebf9939693d07f0d","repo":"kestra-io/kestra","slug":"the-substringafter-filter-expects-an-argument-s","errorCode":null,"errorMessage":"The 'substringAfter' filter expects an argument 'separator'.","messagePattern":"The 'substringAfter' filter expects an argument 'separator'\\.","errorType":"validation","errorClass":"PebbleException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/io/kestra/core/runners/pebble/filters/SubstringAfterFilter.java","lineNumber":33,"sourceCode":"    private final List<String> argumentNames = new ArrayList<>();\n\n    public SubstringAfterFilter() {\n        this.argumentNames.add(\"separator\");\n    }\n\n    @Override\n    public List<String> getArgumentNames() {\n        return this.argumentNames;\n    }\n\n    @Override\n    public Object apply(Object input, Map<String, Object> args, PebbleTemplate self, EvaluationContext context, int lineNumber) throws PebbleException {\n        if (input == null) {\n            return null;\n        }\n\n        if (!args.containsKey(\"separator\")) {\n            throw new PebbleException(null, \"The 'substringAfter' filter expects an argument 'separator'.\", lineNumber, self.getName());\n        }\n\n        String separator = (String) args.get(\"separator\");\n        ;\n\n        return StringUtils.substringAfter(input.toString(), separator);\n    }\n}\n","sourceCodeStart":15,"sourceCodeEnd":42,"githubUrl":"https://github.com/kestra-io/kestra/blob/823fada9274c4f9c251ea0a516460a4f7d958032/core/src/main/java/io/kestra/core/runners/pebble/filters/SubstringAfterFilter.java#L15-L42","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Add the separator argument: {{ myVar | substringAfter(separator=\"-\") }}.","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 ?? \"-\") }}).","Confirm the filter name spelling matches the installed Kestra version; older/newer versions may differ."],"exampleFix":"// before\n{{ outputs.url | substringAfter }}\n// after\n{{ outputs.url | substringAfter(separator=\"/\") }}","handlingStrategy":"validation","validationCode":"// Pebble: ensure separator is bound before applying\n{{ myVar is empty ? '' : myVar | substringAfter(separator=(mySep ?? \"-\")) }}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass the separator as a named argument; never rely on it being optional.","Use the Kestra expression editor to validate the filter before saving the flow.","Keep a snippet library of correctly-formed filter calls."],"tags":["pebble","template","filter","argument"],"backgroundTag":null,"analyzedSha":"823fada9274c4f9c251ea0a516460a4f7d958032","analyzedAt":"2026-08-14T06:15:17.947Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}