{"record":{"id":"852d88243e898ace","repo":"kestra-io/kestra","slug":"the-argument-regex-is-required","errorCode":null,"errorMessage":"The argument 'regex' is required.","messagePattern":"The argument 'regex' is required\\.","errorType":"validation","errorClass":"PebbleException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/io/kestra/core/runners/pebble/filters/RegexExtractFilter.java","lineNumber":57,"sourceCode":"\n    private static final String ARGUMENT_REGEX = \"regex\";\n    private static final String ARGUMENT_GROUP = \"group\";\n\n    private static final List<String> ARGS = List.of(ARGUMENT_REGEX, ARGUMENT_GROUP);\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        String regex = args.get(ARGUMENT_REGEX).toString();\n        int group = args.containsKey(ARGUMENT_GROUP) && args.get(ARGUMENT_GROUP) != null\n            ? ((Number) args.get(ARGUMENT_GROUP)).intValue()\n            : 0;\n\n        if (group < 0) {\n            throw new PebbleException(\n                null,\n                MessageFormat.format(\"Group index {0} is out of bounds: must be >= 0.\", group),\n                lineNumber,\n                self.getName()","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/kestra-io/kestra/blob/823fada9274c4f9c251ea0a516460a4f7d958032/core/src/main/java/io/kestra/core/runners/pebble/filters/RegexExtractFilter.java#L39-L75","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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`)."],"exampleFix":"# before\n{{ \"order-12345\" | regexExtract }}\n# after\n{{ \"order-12345\" | regexExtract(regex=\"\\\\d+\") }}","handlingStrategy":"validation","validationCode":"# Supply regex, optionally defaulted from an input:\n{{ s | regexExtract(regex=inputs.pattern ?? \"\\\\d+\") }}","typeGuard":"{% if inputs.pattern is not null %}\n  {{ s | regexExtract(regex=inputs.pattern) }}\n{% endif %}","tryCatchPattern":null,"preventionTips":["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."],"tags":["pebble-filter","regex-extract","missing-argument","regex"],"backgroundTag":null,"analyzedSha":"823fada9274c4f9c251ea0a516460a4f7d958032","analyzedAt":"2026-08-14T06:15:17.947Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}