kestra-io/kestra · error · PebbleException

Unable to transform to yaml value '{input}' with type '{inpu

Error message

Unable to transform to yaml value '{input}' with type '{input.getClass().getName()}'

What it means

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.

Source

Thrown at core/src/main/java/io/kestra/core/runners/pebble/filters/YamlFilter.java:53

        .registerModule(new Jdk8Module())
        .registerModule(new ParameterNamesModule())
        .registerModules(new GuavaModule());

    @Override
    public List<String> getArgumentNames() {
        return null;
    }

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

        try {
            return MAPPER.writeValueAsString(input);
        } catch (JsonProcessingException e) {
            throw new PebbleException(e, "Unable to transform to yaml value '" + input + "' with type '" + input.getClass().getName() + "'", lineNumber, self.getName());
        }
    }
}

View on GitHub (pinned to 823fada927)

Solutions

  1. Project a plain map of the fields you need before filtering.
  2. Register Jackson serializers/modules for custom types in your plugin.
  3. Eliminate cyclic references prior to serialization.

Example fix

// before
{{ execution | toYaml }}
// after
{{ {id: execution.id, state: execution.state} | toYaml }}
Defensive patterns

Strategy: type-guard

Validate before calling

{{ {id: execution.id, state: execution.state} | toYaml }}

Type guard

// Java: keep input to standard serializable types
if (!(value instanceof Map || value instanceof List || value instanceof String
        || value instanceof Number || value instanceof Boolean)) {
    throw new IllegalArgumentException("Cannot serialize type " + value.getClass());
}

Prevention

When it happens

Trigger: 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.

Common situations: Dumping the whole execution to YAML for logging; serializing nested context objects; plugin output types not registered with Jackson modules.

Related errors


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