apache/seatunnel · error · SeaTunnelJsonFormatException

ILLEGAL_ARGUMENT

ILLEGAL_ARGUMENT

Error message

JSON format doesn't support failOnMissingField and ignoreParseErrors are both enabled.

What it means

JsonDeserializationSchema enforces that the two error-tolerance options are mutually exclusive: failOnMissingField (throw when a JSON field is absent) and ignoreParseErrors (skip malformed JSON records) cannot both be true, since one demands strict failure and the other silent tolerance. When both are enabled the constructor immediately throws SeaTunnelJsonFormatException with ILLEGAL_ARGUMENT. Fix your format configuration so exactly one policy is chosen.

Source

Thrown at seatunnel-formats/seatunnel-format-json/src/main/java/org/apache/seatunnel/format/json/JsonDeserializationSchema.java:74

    private final boolean ignoreParseErrors;

    /** The row type of the produced {@link SeaTunnelRow}. */
    private final SeaTunnelRowType rowType;

    /**
     * Runtime converter that converts {@link JsonNode}s into objects of internal data structures.
     */
    private JsonToRowConverters.JsonToObjectConverter runtimeConverter;

    /** Object mapper for parsing the JSON. */
    private final ObjectMapper objectMapper = new ObjectMapper();

    private CatalogTable catalogTable;

    public JsonDeserializationSchema(
            boolean failOnMissingField, boolean ignoreParseErrors, SeaTunnelRowType rowType) {
        if (ignoreParseErrors && failOnMissingField) {
            throw new SeaTunnelJsonFormatException(
                    CommonErrorCodeDeprecated.ILLEGAL_ARGUMENT,
                    "JSON format doesn't support failOnMissingField and ignoreParseErrors are both enabled.");
        }
        this.rowType = checkNotNull(rowType);
        this.failOnMissingField = failOnMissingField;
        this.ignoreParseErrors = ignoreParseErrors;
        this.runtimeConverter =
                new JsonToRowConverters(failOnMissingField, ignoreParseErrors)
                        .createRowConverter(checkNotNull(rowType));

        if (hasDecimalType(rowType)) {
            objectMapper.enable(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS);
        }
        objectMapper.configure(JsonReadFeature.ALLOW_UNESCAPED_CONTROL_CHARS.mappedFeature(), true);
    }

    public JsonDeserializationSchema(
            CatalogTable catalogTable, boolean failOnMissingField, boolean ignoreParseErrors) {

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Set one of the two options to false in your format configuration — keep failOnMissingField=true and ignoreParseErrors=false for strict parsing, or ignoreParseErrors=true and failOnMissingField=false for tolerant parsing.
  2. If strict validation is desired, remove the ignoreParseErrors option entirely (defaults to false).
  3. If tolerant reading is desired, remove failOnMissingField or set it to false and instead supply default values via row-type definitions.

Example fix

// before
JsonDeserializationSchema schema = new JsonDeserializationSchema(true, true, rowType); // throws
// after
JsonDeserializationSchema schema = new JsonDeserializationSchema(true, false, rowType);
Defensive patterns

Strategy: validation

Validate before calling

if (failOnMissingField && ignoreParseErrors) {
    throw new IllegalArgumentException("failOnMissingField and ignoreParseErrors cannot both be true");
}
JsonDeserializationSchema schema = new JsonDeserializationSchema(failOnMissingField, ignoreParseErrors, rowType);

Try / catch

try {
    schema = new JsonDeserializationSchema(failOnMissingField, ignoreParseErrors, rowType);
} catch (SeaTunnelJsonFormatException e) {
    // fall back to strict mode
    schema = new JsonDeserializationSchema(failOnMissingField, false, rowType);
}

Prevention

When it happens

Trigger: Constructing JsonDeserializationSchema(boolean failOnMissingField, boolean ignoreParseErrors, SeaTunnelRowType rowType) or JsonDeserializationSchema(CatalogTable catalogTable, boolean failOnMissingField, boolean ignoreParseErrors) with both flags set to true — typically via format config failOnMissingField=true and ignoreParseErrors=true in a JSON format block.

Common situations: Users copy a source config template that enables ignoreParseErrors and separately add failOnMissingField=true expecting stricter validation; both flags default or get set true in a shared HOCON/SQL options block.

Related errors


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