apache/flink · error · IllegalArgumentException

Serializer type not specified for {}

Error message

Serializer type not specified for {}

What it means

Thrown during parseSerializationConfig when a serialization-config entry for a class has no 'type' key. The 'type' key determines which registration path is used (pojo, kryo, or typeinfo); its absence means the system does not know how to handle the class. Each entry must be a map containing at least a 'type' field.

Source

Thrown at flink-core/src/main/java/org/apache/flink/api/common/serialization/SerializerConfigImpl.java:408

                                Collectors.toMap(
                                        e ->
                                                loadClass(
                                                        e.getKey(),
                                                        classLoader,
                                                        "Could not load class for serialization config"),
                                        e -> ConfigurationUtils.parseStringToMap(e.getValue()),
                                        (v1, v2) -> {
                                            throw new IllegalArgumentException(
                                                    "Duplicated serializer for the same class.");
                                        },
                                        LinkedHashMap::new));
        for (Map.Entry<Class<?>, Map<String, String>> entry :
                serializationConfigByClass.entrySet()) {
            Class<?> type = entry.getKey();
            Map<String, String> config = entry.getValue();
            String configType = config.get("type");
            if (configType == null) {
                throw new IllegalArgumentException("Serializer type not specified for " + type);
            }
            switch (configType) {
                case "pojo":
                    registerPojoType(type);
                    break;
                case "kryo":
                    parseAndRegisterKryoType(classLoader, type, config);
                    break;
                case "typeinfo":
                    parseAndRegisterTypeFactory(classLoader, type, config);
                    break;
                default:
                    throw new IllegalArgumentException(
                            String.format(
                                    "Unsupported serializer type %s for %s", configType, type));
            }
        }
    }

View on GitHub (pinned to 2f3c205e92)

Solutions

  1. Add the 'type' key to the entry with one of: pojo, kryo, or typeinfo.
  2. Consult the serialization-config documentation for the correct map structure.
  3. Validate each config entry has a 'type' key before deployment.

Example fix

# before
pipeline.serialization-config: "class:com.example.MyType{class:com.example.MyFactory}"

# after
pipeline.serialization-config: "class:com.example.MyType{type:typeinfo,class:com.example.MyFactory}"
Defensive patterns

Strategy: validation

Validate before calling

// Ensure every serialization-config entry has a 'type' key
for (Map.Entry<String, Map<String, String>> e : entries.entrySet()) {
    if (!e.getValue().containsKey("type")) {
        throw new IllegalArgumentException("Missing 'type' for class: " + e.getKey());
    }
}

Prevention

When it happens

Trigger: A serialization-config entry like 'class:com.example.MyType{class:com.example.MyFactory}' where the inner map lacks 'type:typeinfo'. The code reads config.get("type"), gets null, and throws.

Common situations: Misunderstanding the config syntax; omitting the required 'type' field; using an old config format that predates the 'type' requirement.

Related errors


AI-assisted analysis of apache/flink@2f3c205e92 (2026-08-14). Data as JSON: /api/errors/e91cba89b15d5eb1. Report an issue: GitHub.