kestra-io/kestra · error · IllegalArgumentException

Unsupported type for key: {entry.getKey()}, value: {value}

Error message

Unsupported type for key: {entry.getKey()}, value: {value}

What it means

The `ListOrMapOfLabelDeserializer` parses the map form of labels (a JSON object of `{key: value}`). Each value is type-checked by `isAllowedType()`, which accepts String, Integer, Long, Float, Double, and Boolean. If a value is a nested object, array, or null, an `IllegalArgumentException` is thrown via `validateAndCreateLabel` with the offending key and value. This is the map-form counterpart of error 229 (which is the array-form error).

Source

Thrown at core/src/main/java/io/kestra/core/serializers/ListOrMapOfLabelDeserializer.java:54

                }
            }).toList();
        } else if (p.hasToken(JsonToken.START_OBJECT)) {
            // deserialize as map
            Map<String, Object> ret = ctxt.readValue(p, Map.class);
            return ret == null ? null
                : ret.entrySet().stream()
                    .map(this::validateAndCreateLabel)
                    .toList();
        }
        throw new IllegalArgumentException("Unable to deserialize value as it's neither an object neither an array");
    }

    private Label validateAndCreateLabel(Map.Entry<String, Object> entry) {
        Object value = entry.getValue();
        if (isAllowedType(value)) {
            return new Label(entry.getKey(), String.valueOf(value));
        } else {
            throw new IllegalArgumentException("Unsupported type for key: " + entry.getKey() + ", value: " + value);
        }
    }

    private static boolean isAllowedType(Object value) {
        return value instanceof String ||
            value instanceof Integer ||
            value instanceof Long ||
            value instanceof Float ||
            value instanceof Double ||
            value instanceof Boolean;
    }

    @Override
    public void resolve(DeserializationContext ctxt) throws JsonMappingException {
    }
}

View on GitHub (pinned to 823fada927)

Solutions

  1. Ensure every label value in the map form is a scalar: String, number, or boolean.
  2. If you need complex metadata, serialize it to a JSON string.
  3. Avoid null values for label keys — omit the key entirely instead.

Example fix

# before
labels:
  meta:
    nested: true
# after
labels:
  meta: '{"nested":true}'
Defensive patterns

Strategy: validation

Validate before calling

// Validate label values in map form before submission
public static Map<String, Object> validateLabelMap(Map<String, Object> labels) {
    labels.forEach((key, value) -> {
        if (!(value instanceof String || value instanceof Integer || value instanceof Long
            || value instanceof Float || value instanceof Double || value instanceof Boolean)) {
            throw new IllegalArgumentException(
                "Label '" + key + "' has unsupported value type: " + value.getClass());
        }
    });
    return labels;
}

Type guard

function isAllowedLabelValue(v: unknown): boolean {
    const t = typeof v;
    return t === 'string' || t === 'number' || t === 'boolean';
}

Prevention

When it happens

Trigger: Submitting labels as a JSON map where one value is a nested object or array, e.g. `{"meta": {"nested": true}}`. Providing a null value for a key in the map form.

Common situations: A flow YAML uses a nested structure for a label value instead of a flat scalar. An API consumer serializes a complex object where a string is expected.

Related errors


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