kestra-io/kestra · error · PebbleException

The 'yaml' function expects an argument 'yaml'.

Error message

The 'yaml' function expects an argument 'yaml'.

What it means

The Pebble `yaml()` function requires a single argument named `yaml` containing a YAML string to parse. If the argument is absent from the args map, a `PebbleException` is thrown. The default binding (`inputs.yamlInput`) exists but does not populate `args` when the function is called without the named argument.

Source

Thrown at core/src/main/java/io/kestra/core/runners/pebble/functions/YamlFunction.java:37

    final static ObjectMapper MAPPER = new ObjectMapper(
        new YAMLFactory()
    ).findAndRegisterModules();
    private static final TypeReference<Object> TYPE_REFERENCE = new TypeReference<>() {
    };

    public List<String> getArgumentNames() {
        return List.of("yaml");
    }

    @Override
    public Map<String, String> getArgumentDefaults() {
        return Map.of("yaml", "inputs.yamlInput");
    }

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

        if (!(args.get("yaml") instanceof String)) {
            throw new PebbleException(null, "The 'yaml' function expects an argument 'yaml' with type string.", lineNumber, self.getName());
        }

        String yaml = (String) args.get("yaml");

        try {
            return MAPPER.readValue(yaml, TYPE_REFERENCE);
        } catch (JacksonYAMLParseException e) {
            throw new PebbleException(null, "Invalid yaml: " + e.getMessage(), lineNumber, self.getName());
        } catch (JsonMappingException e) {
            throw new PebbleException(null, "Invalid yaml: " + e.getMessage(), lineNumber, self.getName());
        } catch (JsonProcessingException e) {
            throw new PebbleException(null, "Invalid yaml: " + e.getMessage(), lineNumber, self.getName());
        }
    }

View on GitHub (pinned to 823fada927)

Solutions

  1. Pass the `yaml` argument explicitly: `yaml(yaml=inputs.yamlInput)` or `yaml(inputs.yamlInput)`.
  2. Verify the argument name is exactly `yaml`.
  3. Ensure the referenced variable (e.g. `inputs.yamlInput`) is actually defined and non-null.

Example fix

# before
{{ yaml() }}
# after
{{ yaml(inputs.yamlInput) }}
Defensive patterns

Strategy: validation

Validate before calling

# Pebble template: always pass the yaml argument
{{ yaml(inputs.yamlInput) }}
{{ yaml(yaml=someVariable) }}

Prevention

When it happens

Trigger: Calling `yaml()` with no arguments. Calling it with a wrong argument name (e.g. `yaml(content='...')`).

Common situations: A developer passes a variable that resolves to null or omits the argument entirely, expecting the default to kick in automatically.

Related errors


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