{"record":{"id":"c5a326f713ccad8c","repo":"kestra-io/kestra","slug":"the-loopoutputs-function-expects-a-non-null-argu-c5a326","errorCode":null,"errorMessage":"The 'loopOutputs' function expects a non-null argument 'name'.","messagePattern":"The 'loopOutputs' function expects a non-null argument 'name'\\.","errorType":"validation","errorClass":"PebbleException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/io/kestra/core/runners/pebble/functions/LoopOutputsFunction.java","lineNumber":47,"sourceCode":"\n    @Override\n    public Map<String, String> getArgumentDefaults() {\n        return ARGUMENT_DEFAULTS;\n    }\n\n    @Override\n    public Object execute(Map<String, Object> args, PebbleTemplate self, EvaluationContext context, int lineNumber) {\n        Object outputsArg = args.get(ARG_OUTPUTS);\n        if (outputsArg == null) {\n            throw new PebbleException(null, \"The 'loopOutputs' function expects a non-null argument 'outputs'.\", lineNumber, self.getName());\n        }\n        if (!(outputsArg instanceof List<?>)) {\n            throw new PebbleException(null, \"The 'loopOutputs' function expects 'outputs' to be a list.\", lineNumber, self.getName());\n        }\n\n        Object nameArg = args.get(ARG_NAME);\n        if (nameArg == null) {\n            throw new PebbleException(null, \"The 'loopOutputs' function expects a non-null argument 'name'.\", lineNumber, self.getName());\n        }\n        if (!(nameArg instanceof String)) {\n            throw new PebbleException(null, \"The 'loopOutputs' function expects 'name' to be a string.\", lineNumber, self.getName());\n        }\n\n        String key = (String) nameArg;\n        List<?> loopOutputs = (List<?>) outputsArg;\n        List<Object> result = new ArrayList<>(loopOutputs.size());\n\n        for (Object loopOutputObj : loopOutputs) {\n            if (loopOutputObj instanceof Map<?, ?> loopOutput) {\n                Object iterationOutputs = loopOutput.get(ITERATION_OUTPUTS_KEY);\n                result.add(iterationOutputs instanceof Map<?, ?> outputs ? outputs.get(key) : null);\n            } else {\n                result.add(null);\n            }\n        }\n","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/kestra-io/kestra/blob/823fada9274c4f9c251ea0a516460a4f7d958032/core/src/main/java/io/kestra/core/runners/pebble/functions/LoopOutputsFunction.java#L29-L65","documentation":"The loopOutputs(outputs, name) function requires a non-null 'name' argument — the output key to extract from each iteration's outputs map. If name is null or absent, the function cannot determine which output field to collect from each loop iteration.","triggerScenarios":"Calling {{ loopOutputs(outputs.myLoop.outputs) }} without the second argument. Passing name=null or a variable that resolves to null. Using positional arguments where the second position is missing.","commonSituations":"The author forgets the second argument. The output name is dynamically computed from a variable that is null.","solutions":["Always provide the name argument: {{ loopOutputs(outputs.myLoop.outputs, 'myOutputKey') }}.","Ensure the name matches an actual output field defined in the loop's child task."],"exampleFix":"# before\nvalue: \"{{ loopOutputs(outputs.myLoop.outputs) }}\"\n# after\nvalue: \"{{ loopOutputs(outputs.myLoop.outputs, 'result') }}\"","handlingStrategy":"validation","validationCode":"# Always provide both arguments:\n{{ loopOutputs(outputs.myLoop.outputs, 'myOutput') }}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always supply the 'name' argument to loopOutputs.","Ensure the name matches an output field defined in the loop's child task.","Use Pebble 'is not null' guards when the name comes from a dynamic variable."],"tags":["pebble-function","loopoutputs","missing-argument"],"backgroundTag":null,"analyzedSha":"823fada9274c4f9c251ea0a516460a4f7d958032","analyzedAt":"2026-08-14T06:15:17.947Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}