apache/seatunnel · error · java.lang.IllegalArgumentException

Could not parse json, value

Error message

Could not parse json, value: %s

What it means

A generic serialization guard in ConfigUtil.convertToJsonString: the object being converted to its JSON string representation could not be serialized by the underlying JSON library. It fires on any non-String, non-null object whose type is not supported (non-bean types, unserializable classes).

Solutions

  1. Ensure the object passed to convertToJsonString is a simple type, Map, Collection, or a bean with a no-arg constructor and getters
  2. Convert unsupported custom types to a Map or String before serialization
  3. Inspect the value logged in the message to identify which object failed serialization
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at seatunnel-api/src/main/java/org/apache/seatunnel/api/configuration/util/ConfigUtil.java:312 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/62de00d57de0accd. Report an issue: GitHub.

Appendix: source

Thrown at seatunnel-api/src/main/java/org/apache/seatunnel/api/configuration/util/ConfigUtil.java:312

                .orElseThrow(
                        () ->
                                new IllegalArgumentException(
                                        String.format(
                                                "Could not parse value for enum %s. Expected one of: [%s]",
                                                clazz, Arrays.toString(clazz.getEnumConstants()))));
    }

    public static String convertToJsonString(Object o) {
        if (o == null) {
            return null;
        }
        if (o instanceof String) {
            return (String) o;
        }
        try {
            return JACKSON_MAPPER.writeValueAsString(o);
        } catch (JsonProcessingException e) {
            throw new IllegalArgumentException(String.format("Could not parse json, value: %s", o));
        }
    }

    public static String convertToJsonString(Config config) {
        return convertToJsonString(config.root().unwrapped());
    }

    public static Config convertToConfig(String configJson) {
        return ConfigFactory.parseString(configJson);
    }
}

View on GitHub (pinned to cf67b549a7)