kestra-io/kestra · error · PebbleException

Unable to transform to ion value '{input}' with type '{input

Error message

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

What it means

The 'toIon' filter serializes its input to Amazon Ion text via a Jackson IonObjectMapper. If Jackson cannot serialize the value (cyclic reference, type with no serializer, Jackson-detectable failure), a JsonProcessingException is caught and rethrown as a PebbleException naming the offending value and its class.

Source

Thrown at core/src/main/java/io/kestra/core/runners/pebble/filters/ToIonFilter.java:33

public class ToIonFilter implements Filter {
    private static final ObjectMapper MAPPER = JacksonMapper.ofIon();

    @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 ion value '" + input + "' with type '" + input.getClass().getName() + "'", lineNumber, self.getName());
        }
    }
}

View on GitHub (pinned to 823fada927)

Solutions

  1. Reduce the input to a primitive/map/list before filtering: project only the fields you need with a map/select expression first.
  2. Register a Jackson serializer for the custom type in your plugin.
  3. Break cyclic references before serializing (strip the back-pointer field).

Example fix

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

Strategy: type-guard

Validate before calling

// Pebble: project to a plain map before serializing to Ion
{{ {id: execution.id, state: execution.state} | toIon }}

Type guard

// Java: ensure the value is a Jackson-friendly type before exposing it
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 that contains a self-reference or a field Jackson cannot introspect into {{ x | toIon }}; piping a raw Java type not registered with the mapper (e.g. a custom object exposed through a plugin output).

Common situations: Passing execution/flow context objects that carry back-references; plugin outputs exposing non-serializable types; large/recursive structures triggering Jackson limits.

Related errors


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