{"record":{"id":"6c149fd165879fd0","repo":"kestra-io/kestra","slug":"chunk-filter-expects-an-argument-size","errorCode":null,"errorMessage":"'chunk' filter expects an argument 'size'.","messagePattern":"'chunk' filter expects an argument 'size'\\.","errorType":"validation","errorClass":"PebbleException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/io/kestra/core/runners/pebble/filters/ChunkFilter.java","lineNumber":27,"sourceCode":"import io.pebbletemplates.pebble.extension.Filter;\nimport io.pebbletemplates.pebble.template.EvaluationContext;\nimport io.pebbletemplates.pebble.template.PebbleTemplate;\n\npublic class ChunkFilter implements Filter {\n    @Override\n    public List<String> getArgumentNames() {\n        return List.of(\"size\");\n    }\n\n    @SuppressWarnings({ \"unchecked\", \"rawtypes\" })\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(\"size\")) {\n            throw new PebbleException(null, \"'chunk' filter expects an argument 'size'.\", lineNumber, self.getName());\n        }\n\n        if (!(input instanceof List)) {\n            throw new PebbleException(null, \"'chunk' filter can only be applied to List. Actual type was: \" + input.getClass().getName(), lineNumber, self.getName());\n        }\n\n        Object sizeObj = args.get(\"size\");\n        if (!(sizeObj instanceof Number)) {\n            throw new PebbleException(null, \"'chunk' filter argument 'size' must be a number. Actual type was: \" + sizeObj.getClass().getName(), lineNumber, self.getName());\n        }\n        return Lists.partition((List) input, ((Number) sizeObj).intValue());\n    }\n}\n","sourceCodeStart":9,"sourceCodeEnd":41,"githubUrl":"https://github.com/kestra-io/kestra/blob/823fada9274c4f9c251ea0a516460a4f7d958032/core/src/main/java/io/kestra/core/runners/pebble/filters/ChunkFilter.java#L9-L41","documentation":"Thrown by the ChunkFilter Pebble filter when the required 'size' argument is not provided. The chunk filter splits a list into sub-lists of the given maximum size, so the size is mandatory.","triggerScenarios":"Calling the chunk filter without the size argument: '{{ mylist | chunk }}'. Pebble passes only named arguments that are present, so omitting size entirely leaves it out of the args map.","commonSituations":"Batching a list for parallel processing in a flow and forgetting the batch size. Copying a chunk filter call from documentation that showed the argument positionally but omitting it.","solutions":["Provide the mandatory size argument: '{{ mylist | chunk(10) }}'.","Ensure the size is a valid integer, not a null-valued variable."],"exampleFix":"{# before #}\n{{ mylist | chunk }}\n\n{# after #}\n{{ mylist | chunk(10) }}","handlingStrategy":"validation","validationCode":"{# Always pass the size argument when using chunk #}\n{% set batch_size = vars.batch_size ?? 10 %}\n{{ mylist | chunk(batch_size) }}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always provide the size as the first positional argument to chunk.","Default the size variable with ?? to avoid null.","Keep a reference snippet of correct chunk usage in your flow template library."],"tags":["pebble","chunk-filter","missing-argument","list"],"backgroundTag":null,"analyzedSha":"823fada9274c4f9c251ea0a516460a4f7d958032","analyzedAt":"2026-08-14T06:15:17.947Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}