kestra-io/kestra · error · PebbleException
The 'loopOutputs' function expects a non-null argument 'name
Error message
The 'loopOutputs' function expects a non-null argument 'name'.
What it means
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.
Source
Thrown at core/src/main/java/io/kestra/core/runners/pebble/functions/LoopOutputsFunction.java:47
@Override
public Map<String, String> getArgumentDefaults() {
return ARGUMENT_DEFAULTS;
}
@Override
public Object execute(Map<String, Object> args, PebbleTemplate self, EvaluationContext context, int lineNumber) {
Object outputsArg = args.get(ARG_OUTPUTS);
if (outputsArg == null) {
throw new PebbleException(null, "The 'loopOutputs' function expects a non-null argument 'outputs'.", lineNumber, self.getName());
}
if (!(outputsArg instanceof List<?>)) {
throw new PebbleException(null, "The 'loopOutputs' function expects 'outputs' to be a list.", lineNumber, self.getName());
}
Object nameArg = args.get(ARG_NAME);
if (nameArg == null) {
throw new PebbleException(null, "The 'loopOutputs' function expects a non-null argument 'name'.", lineNumber, self.getName());
}
if (!(nameArg instanceof String)) {
throw new PebbleException(null, "The 'loopOutputs' function expects 'name' to be a string.", lineNumber, self.getName());
}
String key = (String) nameArg;
List<?> loopOutputs = (List<?>) outputsArg;
List<Object> result = new ArrayList<>(loopOutputs.size());
for (Object loopOutputObj : loopOutputs) {
if (loopOutputObj instanceof Map<?, ?> loopOutput) {
Object iterationOutputs = loopOutput.get(ITERATION_OUTPUTS_KEY);
result.add(iterationOutputs instanceof Map<?, ?> outputs ? outputs.get(key) : null);
} else {
result.add(null);
}
}
View on GitHub (pinned to 823fada927)
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.
Example fix
# before
value: "{{ loopOutputs(outputs.myLoop.outputs) }}"
# after
value: "{{ loopOutputs(outputs.myLoop.outputs, 'result') }}" Defensive patterns
Strategy: validation
Validate before calling
# Always provide both arguments:
{{ loopOutputs(outputs.myLoop.outputs, 'myOutput') }} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: The author forgets the second argument. The output name is dynamically computed from a variable that is null.
Related errors
- The 'loopOutputs' function expects a non-null argument 'outp
- The 'isWeekend()' function expects a 'date' argument.
- The 'kv' function expects an argument 'key'.
- The 'loopOutputs' function expects 'outputs' to be a list.
- The 'loopOutputs' function expects 'name' to be a string.
AI-assisted analysis of kestra-io/kestra@823fada927 (2026-08-14).
Data as JSON: /api/errors/c5a326f713ccad8c.
Report an issue: GitHub.