{"record":{"id":"f65b1e6db7f5c041","repo":"kestra-io/kestra","slug":"unable-to-transform-to-yaml-value-input-with-t","errorCode":null,"errorMessage":"Unable to transform to yaml value '{input}' with type '{input.getClass().getName()}'","messagePattern":"Unable to transform to yaml value '(.+?)' with type '(.+?)'","errorType":"exception","errorClass":"PebbleException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/io/kestra/core/runners/pebble/filters/YamlFilter.java","lineNumber":53,"sourceCode":"        .registerModule(new Jdk8Module())\n        .registerModule(new ParameterNamesModule())\n        .registerModules(new GuavaModule());\n\n    @Override\n    public List<String> getArgumentNames() {\n        return null;\n    }\n\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        try {\n            return MAPPER.writeValueAsString(input);\n        } catch (JsonProcessingException e) {\n            throw new PebbleException(e, \"Unable to transform to yaml value '\" + input + \"' with type '\" + input.getClass().getName() + \"'\", lineNumber, self.getName());\n        }\n    }\n}\n","sourceCodeStart":35,"sourceCodeEnd":57,"githubUrl":"https://github.com/kestra-io/kestra/blob/823fada9274c4f9c251ea0a516460a4f7d958032/core/src/main/java/io/kestra/core/runners/pebble/filters/YamlFilter.java#L35-L57","documentation":"The 'toYaml' filter serializes its input to a YAML string through a Jackson YAMLFactory-backed ObjectMapper (quotes minimized, no doc-start marker). If serialization fails with JsonProcessingException the filter rethrows a PebbleException naming the value and its class.","triggerScenarios":"Piping an object with a cyclic reference or an unserializable type into {{ x | toYaml }}; passing execution/flow objects that contain back-references; custom plugin types lacking a Jackson serializer.","commonSituations":"Dumping the whole execution to YAML for logging; serializing nested context objects; plugin output types not registered with Jackson modules.","solutions":["Project a plain map of the fields you need before filtering.","Register Jackson serializers/modules for custom types in your plugin.","Eliminate cyclic references prior to serialization."],"exampleFix":"// before\n{{ execution | toYaml }}\n// after\n{{ {id: execution.id, state: execution.state} | toYaml }}","handlingStrategy":"type-guard","validationCode":"{{ {id: execution.id, state: execution.state} | toYaml }}","typeGuard":"// Java: keep input to standard serializable types\nif (!(value instanceof Map || value instanceof List || value instanceof String\n        || value instanceof Number || value instanceof Boolean)) {\n    throw new IllegalArgumentException(\"Cannot serialize type \" + value.getClass());\n}","tryCatchPattern":null,"preventionTips":["Do not dump whole execution/flow objects; project needed fields.","Register Jackson serializers for custom plugin types.","Eliminate cyclic references before serializing to YAML."],"tags":["pebble","filter","serialization","yaml","jackson"],"backgroundTag":null,"analyzedSha":"823fada9274c4f9c251ea0a516460a4f7d958032","analyzedAt":"2026-08-14T06:15:17.947Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}