kestra-io/kestra · error · IllegalVariableEvaluationException

Invalid `files` properties with type '{}'

Error message

Invalid `files` properties with type '{}'

What it means

Thrown by PluginUtilsService.transformInputFiles() when the inputFiles argument is neither a Map nor a String — the only two supported shapes. A Map is treated as key/value file entries (rendered per-entry), a String is rendered then parsed as JSON. Any other runtime type (List, Number, Boolean, or null in some code paths) is rejected as an IllegalVariableEvaluationException with the offending class name in the message.

Source

Thrown at core/src/main/java/io/kestra/core/models/tasks/runners/PluginUtilsService.java:110

        throws IllegalVariableEvaluationException, JsonProcessingException {
        if (inputFiles instanceof Map) {
            Map<String, String> castedInputFiles = (Map<String, String>) inputFiles;
            Map<String, String> nullFilteredInputFiles = new HashMap<>();
            castedInputFiles.forEach((key, val) ->
            {
                if (val != null) {
                    nullFilteredInputFiles.put(key, val);
                }
            });
            return runContext.renderMap(nullFilteredInputFiles, additionalVars);
        } else if (inputFiles instanceof String inputFileString) {

            return JacksonMapper.ofJson(false).readValue(
                runContext.render(inputFileString, additionalVars),
                MAP_TYPE_REFERENCE
            );
        } else {
            throw new IllegalVariableEvaluationException("Invalid `files` properties with type '" + (inputFiles != null ? inputFiles.getClass() : "null") + "'");
        }
    }

    public static Map<String, Object> parseOut(String line, Logger logger, RunContext runContext, boolean isStdErr, Instant customInstant) {
        return parseOut(line, logger, runContext, isStdErr, customInstant, false);
    }

    public static Map<String, Object> parseOut(String line, Logger logger, RunContext runContext, boolean isStdErr, Instant customInstant, boolean debug) {

        TaskLogLineMatcher logLineMatcher = ((DefaultRunContext) runContext).services().taskLogLineMatcher();

        Map<String, Object> outputs = new HashMap<>();
        try {
            Optional<TaskLogMatch> matches = logLineMatcher.matches(line, logger, runContext, customInstant);
            if (matches.isPresent()) {
                TaskLogMatch taskLogMatch = matches.get();
                outputs.putAll(taskLogMatch.outputs());
            } else if (isStdErr) {

View on GitHub (pinned to 823fada927)

Solutions

  1. Provide inputFiles as a Map (key=filename, value=content or ROSA) or as a JSON string.
  2. If using a JSON string, ensure it is valid JSON after rendering.
  3. Check Pebble rendering output type — it must resolve to Map or String.

Example fix

# before
inputFiles:
  - data.csv

# after
inputFiles:
  data.csv: "{{ outputs.task.uri }}"
Defensive patterns

Strategy: type-guard

Validate before calling

if (!(inputFiles instanceof Map) && !(inputFiles instanceof String)) {
    throw new IllegalVariableEvaluationException(
        "inputFiles must be a Map or a JSON String, got: " + (inputFiles == null ? "null" : inputFiles.getClass()));
}

Type guard

function isInputFilesValid(v: unknown): v is Record<string, unknown> | string {
  return typeof v === 'string' || (typeof v === 'object' && v !== null && !Array.isArray(v));
}

Try / catch

try {
    PluginUtilsService.transformInputFiles(runContext, additionalVars, inputFiles);
} catch (IllegalVariableEvaluationException e) {
    log.error("inputFiles invalid: {}", e.getMessage());
}

Prevention

When it happens

Trigger: Passing a YAML list of strings where a map is expected; a Pebble expression renders inputFiles to a number or boolean; null is passed through a path that does not short-circuit; malformed JSON string that Jackson fails to parse (caught as Exception, rethrown as this).

Common situations: Flow author writes inputFiles as a YAML sequence instead of a mapping; a variable substitution yields a non-string/non-map object; JSON string is malformed.

Related errors


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