kestra-io/kestra · error · PebbleException

The 'fromIon' function expects an argument 'ion'.

Error message

The 'fromIon' function expects an argument 'ion'.

What it means

Thrown by the 'fromIon' function when the args map does not contain the 'ion' entry. The function parses Kestra Ion data (the row-oriented serialization used by task outputs); 'ion' is the single required argument. A later, separate check handles a null ion value (returns null) and a wrong-type value, so this guard only covers the absence of the key.

Source

Thrown at core/src/main/java/io/kestra/core/runners/pebble/functions/FromIonFunction.java:36

public class FromIonFunction implements KestraFunction {
    public static final String NAME = "fromIon";

    public List<String> getArgumentNames() {
        return List.of("ion", "allRows");
    }

    @Override
    public Map<String, String> getArgumentDefaults() {
        HashMap<String, String> defaults = new HashMap<>();
        defaults.put("ion", ReadFileFunction.NAME + "('ion/namespace/file')");
        defaults.put("allRows", null);
        return defaults;
    }

    @Override
    public Object execute(Map<String, Object> args, PebbleTemplate self, EvaluationContext context, int lineNumber) {
        if (!args.containsKey("ion")) {
            throw new PebbleException(null, "The 'fromIon' function expects an argument 'ion'.", lineNumber, self.getName());
        }

        Object ionArg = args.get("ion");
        if (ionArg == null) {
            return null;
        }

        byte[] ionBytes;
        if (ionArg instanceof byte[] bytes) {
            ionBytes = bytes;
        } else if (ionArg instanceof String str) {
            ionBytes = str.getBytes(StandardCharsets.UTF_8);
        } else {
            throw new PebbleException(null, "The 'fromIon' function expects an argument 'ion' with type string or byte[].", lineNumber, self.getName());
        }

        boolean allRows = args.containsKey("allRows") ? (Boolean) args.get("allRows") : false;

View on GitHub (pinned to 823fada927)

Solutions

  1. Provide the 'ion' argument, typically the output of readFile() on an Ion file: fromIon(readFile(outputs.task.outputFiles['data.ion'])).
  2. If using named arguments, spell it exactly as 'ion'.
  3. Make sure the expression feeding 'ion' actually resolves to Ion content (string or bytes), not a file path or null.

Example fix

# before
rows: "{{ fromIon() }}"
# after
rows: "{{ fromIon(readFile('ion/namespace/file')) }}"
Defensive patterns

Strategy: validation

Validate before calling

# Ensure the 'ion' argument is provided before calling fromIon().
# {{ (ionContent != null) ? fromIon(ionContent) : null }}

Prevention

When it happens

Trigger: Calling fromIon() with no arguments, fromIon(someOther='x'), or misspelling the argument so Pebble does not bind it to 'ion'.

Common situations: Forgetting the argument after autocompleting from getArgumentDefaults(); renaming 'ion'; assuming the function reads a file path directly (it takes already-read Ion content, often via readFile()).

Related errors


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