kestra-io/kestra · error · PebbleException

'values' filter can only be applied to Map. Actual type was:

Error message

'values' filter can only be applied to Map. Actual type was: {input.getClass().getName()}

What it means

The 'values' filter returns the values of a Map. After a null check it tests 'input instanceof Map' and returns the values; for any other non-null type it throws a PebbleException reporting the actual runtime class. It does not support lists, arrays, strings, or scalars.

Source

Thrown at core/src/main/java/io/kestra/core/runners/pebble/filters/ValuesFilter.java:28

public class ValuesFilter implements Filter {
    @Override
    public List<String> getArgumentNames() {
        return null;
    }

    @SuppressWarnings("rawtypes")
    @Override
    public Object apply(Object input, Map<String, Object> args, PebbleTemplate self, EvaluationContext context, int lineNumber) throws PebbleException {
        if (input == null) {
            return null;
        }

        if (input instanceof Map inputMap) {
            return inputMap.values();
        }

        throw new PebbleException(null, "'values' filter can only be applied to Map. Actual type was: " + input.getClass().getName(), lineNumber, self.getName());
    }
}

View on GitHub (pinned to 823fada927)

Solutions

  1. Confirm the input is actually a Map at runtime (inspect the upstream task output schema).
  2. If you have a list and want its elements, use iteration or the appropriate list filter instead.
  3. Guard the type before applying values: wrap in a conditional that checks the structure.

Example fix

// before
{{ outputs.api.body | values }}
// after (only when body is an object)
{% if outputs.api.body is iterable and outputs.api.body is not empty %}{{ outputs.api.body | values }}{% endif %}
Defensive patterns

Strategy: type-guard

Validate before calling

// Pebble: only call values when the input is a map-like object
{% if outputs.x is iterable and outputs.x is not empty %}{{ outputs.x | values }}{% endif %}

Type guard

// Java: narrow before applying
if (input instanceof Map<?, ?> map) { return map.values(); }
throw new IllegalArgumentException("values() requires a Map, got " + input.getClass());

Prevention

When it happens

Trigger: Applying {{ x | values }} to a JSON array, a list, a string, or a scalar. For example piping an outputs field that is a list rather than a map, or a value that is null-surviving (null returns null, but a number/list throws).

Common situations: Assuming an output is a map when the upstream task returns a list; schema drift in an API response changing a map to a list; piping a string by mistake.

Related errors


AI-assisted analysis of kestra-io/kestra@823fada927 (2026-08-14). Data as JSON: /api/errors/01d02e26577ef669. Report an issue: GitHub.