{"record":{"id":"b4952da26e463e49","repo":"kestra-io/kestra","slug":"the-argument-0-is-required","errorCode":null,"errorMessage":"The argument ''{0}'' is required.","messagePattern":"The argument ''(.+?)'' is required\\.","errorType":"validation","errorClass":"PebbleException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/io/kestra/core/runners/pebble/filters/RegexReplaceFilter.java","lineNumber":51,"sourceCode":"\n    private static final String ARGUMENT_REGEX = \"regex\";\n    private static final String ARGUMENT_REPLACEMENT = \"replacement\";\n\n    private static final List<String> ARGS = List.of(ARGUMENT_REGEX, ARGUMENT_REPLACEMENT);\n\n    @Override\n    public List<String> getArgumentNames() {\n        return ARGS;\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.get(ARGUMENT_REGEX) == null) {\n            throw new PebbleException(\n                null,\n                MessageFormat.format(\"The argument ''{0}'' is required.\", ARGUMENT_REGEX),\n                lineNumber,\n                self.getName()\n            );\n        }\n\n        if (args.get(ARGUMENT_REPLACEMENT) == null) {\n            throw new PebbleException(\n                null,\n                MessageFormat.format(\"The argument ''{0}'' is required.\", ARGUMENT_REPLACEMENT),\n                lineNumber,\n                self.getName()\n            );\n        }\n\n        String regex = args.get(ARGUMENT_REGEX).toString();\n        String replacement = args.get(ARGUMENT_REPLACEMENT).toString();","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/kestra-io/kestra/blob/823fada9274c4f9c251ea0a516460a4f7d958032/core/src/main/java/io/kestra/core/runners/pebble/filters/RegexReplaceFilter.java#L33-L69","documentation":"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.","triggerScenarios":"Calling `{{ s | regexReplace(replacement=\"x\") }}` without `regex`; passing a variable for regex that resolved to null; misspelling the argument name.","commonSituations":"Refactoring drops the regex argument; referencing an unset input as the pattern; confusing positional vs named arguments.","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."],"exampleFix":"# before\n{{ slug | regexReplace(replacement=\"-\") }}\n# after\n{{ slug | regexReplace(regex=\"\\\\s+\", replacement=\"-\") }}","handlingStrategy":"validation","validationCode":"# Supply both arguments:\n{{ s | regexReplace(regex=inputs.pattern ?? \".*\", replacement=inputs.repl ?? \"\") }}","typeGuard":"{% if inputs.pattern is not null %}\n  {{ s | regexReplace(regex=inputs.pattern, replacement=\"x\") }}\n{% endif %}","tryCatchPattern":null,"preventionTips":["Always pass `regex` and `replacement` as named arguments.","Capture groups in the replacement use `$1`, `$2`.","Lint for regexReplace calls missing either argument."],"tags":["pebble-filter","regex-replace","missing-argument","regex"],"backgroundTag":null,"analyzedSha":"823fada9274c4f9c251ea0a516460a4f7d958032","analyzedAt":"2026-08-14T06:15:17.947Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}