{"record":{"id":"226c8c5962cebf0d","repo":"kestra-io/kestra","slug":"the-argument-0-is-required-226c8c","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/ReplaceFilter.java","lineNumber":38,"sourceCode":"    private static final String ARGUMENT_PAIRS = \"replace_pairs\";\n    private static final String ARGUMENT_REGEXP = \"regexp\";\n\n    private final static List<String> ARGS = List.of(ARGUMENT_PAIRS, ARGUMENT_REGEXP);\n\n    @Override\n    public List<String> getArgumentNames() {\n        return ARGS;\n    }\n\n    @Override\n    @SuppressWarnings(\"unchecked\")\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_PAIRS) == null) {\n            throw new PebbleException(\n                null,\n                MessageFormat.format(\"The argument ''{0}'' is required.\", ARGUMENT_PAIRS), lineNumber,\n                self.getName()\n            );\n        }\n\n        final boolean regexp = args.containsKey(ARGUMENT_REGEXP) ? (Boolean) args.get(ARGUMENT_REGEXP) : false;\n        Map<?, ?> replacePair = (Map<?, ?>) args.get(ARGUMENT_PAIRS);\n\n        try {\n            if (input instanceof Map) {\n                return processMap((Map<String, Object>) input, replacePair, regexp);\n            } else if (input instanceof List) {\n                return processList((List<Object>) input, replacePair, regexp);\n            } else {\n                return processString(input.toString(), replacePair, regexp);\n            }\n        } catch (RegexUtils.RegexTimeoutException e) {","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/kestra-io/kestra/blob/823fada9274c4f9c251ea0a516460a4f7d958032/core/src/main/java/io/kestra/core/runners/pebble/filters/ReplaceFilter.java#L20-L56","documentation":"Thrown by the 'replace' Pebble filter when the required `replace_pairs` argument is null or missing. The filter expects a Map of find→replacement pairs (and an optional boolean `regexp` flag); without the pairs map it cannot perform any substitution.","triggerScenarios":"Calling `{{ s | replace }}` or `{{ s | replace(regexp=true) }}` without `replace_pairs`; passing a variable for `replace_pairs` that resolved to null; misspelling the argument (e.g. `pairs=` instead of `replace_pairs=`).","commonSituations":"Confusing the argument name (it is the verbose `replace_pairs`, not `pairs` or `mapping`); referencing an unset input; refactoring drops the argument.","solutions":["Supply the map: `{{ s | replace(replace_pairs={\"a\":\"b\"}) }}`.","For literal substitution leave `regexp` off; set `regexp=true` only when keys are regexes.","Default dynamic pairs: `replace_pairs=inputs.mappings ?? {}`."],"exampleFix":"# before\n{{ msg | replace(regexp=true) }}\n# after\n{{ msg | replace(replace_pairs={\"\\\\s+\":\"_\"}, regexp=true) }}","handlingStrategy":"validation","validationCode":"# Always pass the replace_pairs map (named exactly):\n{{ s | replace(replace_pairs=inputs.mappings ?? {}) }}","typeGuard":"{% if inputs.mappings is not null %}\n  {{ s | replace(replace_pairs=inputs.mappings) }}\n{% endif %}","tryCatchPattern":null,"preventionTips":["Remember the argument name is `replace_pairs` (verbose), not `pairs`.","Leave `regexp` off unless keys are regexes.","Lint flows for replace calls missing the map argument."],"tags":["pebble-filter","replace","missing-argument","map"],"backgroundTag":null,"analyzedSha":"823fada9274c4f9c251ea0a516460a4f7d958032","analyzedAt":"2026-08-14T06:15:17.947Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}