{"record":{"id":"01d02e26577ef669","repo":"kestra-io/kestra","slug":"values-filter-can-only-be-applied-to-map-actual","errorCode":null,"errorMessage":"'values' filter can only be applied to Map. Actual type was: {input.getClass().getName()}","messagePattern":"'values' filter can only be applied to Map\\. Actual type was: (.+?)","errorType":"validation","errorClass":"PebbleException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/io/kestra/core/runners/pebble/filters/ValuesFilter.java","lineNumber":28,"sourceCode":"\npublic class ValuesFilter implements Filter {\n    @Override\n    public List<String> getArgumentNames() {\n        return null;\n    }\n\n    @SuppressWarnings(\"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 (input instanceof Map inputMap) {\n            return inputMap.values();\n        }\n\n        throw new PebbleException(null, \"'values' filter can only be applied to Map. Actual type was: \" + input.getClass().getName(), lineNumber, self.getName());\n    }\n}\n","sourceCodeStart":10,"sourceCodeEnd":31,"githubUrl":"https://github.com/kestra-io/kestra/blob/823fada9274c4f9c251ea0a516460a4f7d958032/core/src/main/java/io/kestra/core/runners/pebble/filters/ValuesFilter.java#L10-L31","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Confirm the input is actually a Map at runtime (inspect the upstream task output schema).","If you have a list and want its elements, use iteration or the appropriate list filter instead.","Guard the type before applying values: wrap in a conditional that checks the structure."],"exampleFix":"// before\n{{ outputs.api.body | values }}\n// after (only when body is an object)\n{% if outputs.api.body is iterable and outputs.api.body is not empty %}{{ outputs.api.body | values }}{% endif %}","handlingStrategy":"type-guard","validationCode":"// Pebble: only call values when the input is a map-like object\n{% if outputs.x is iterable and outputs.x is not empty %}{{ outputs.x | values }}{% endif %}","typeGuard":"// Java: narrow before applying\nif (input instanceof Map<?, ?> map) { return map.values(); }\nthrow new IllegalArgumentException(\"values() requires a Map, got \" + input.getClass());","tryCatchPattern":null,"preventionTips":["Inspect the upstream task output schema to confirm it is a map, not a list.","Use list-oriented filters for list inputs.","Guard with an iterable/empty check before applying values."],"tags":["pebble","filter","type-mismatch","map"],"backgroundTag":null,"analyzedSha":"823fada9274c4f9c251ea0a516460a4f7d958032","analyzedAt":"2026-08-14T06:15:17.947Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}