apache/seatunnel · error · HttpConnectorException

COMMON_ILLEGAL_ARGUMENT

COMMON_ILLEGAL_ARGUMENT

Error message

Unsupported data format [%s], http connector only support json format now

What it means

HttpSource.buildSchemaWithConfig throws HttpConnectorException with CommonErrorCodeDeprecated.ILLEGAL_ARGUMENT when the configured data_format is anything other than JSON, because the HTTP source currently only builds a schema from JSON responses. It fails at connector construction time, before reading starts.

Source

Thrown at seatunnel-connectors-v2/connector-http/connector-http-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/http/source/HttpSource.java:187

                                                    "partIndex",
                                                    BasicType.LONG_TYPE,
                                                    0,
                                                    false,
                                                    null,
                                                    null))
                                    .build();
                    this.catalogTable =
                            CatalogTable.of(
                                    TableIdentifier.of(
                                            HttpConfig.CONNECTOR_IDENTITY, TablePath.DEFAULT),
                                    binarySchema,
                                    Collections.emptyMap(),
                                    Collections.emptyList(),
                                    null);
                    break;
                default:
                    // TODO: use format SPI
                    throw new HttpConnectorException(
                            CommonErrorCodeDeprecated.ILLEGAL_ARGUMENT,
                            String.format(
                                    "Unsupported data format [%s], http connector only support json format now",
                                    format));
            }
        } else {
            HttpConfig.ResponseFormat format = pluginConfig.get(HttpSourceOptions.FORMAT);
            if (format == HttpConfig.ResponseFormat.BINARY) {
                this.binaryMode = true;
                this.binaryChunkSize = pluginConfig.get(HttpSourceOptions.BINARY_CHUNK_SIZE);
                TableSchema binarySchema =
                        TableSchema.builder()
                                .column(
                                        PhysicalColumn.of(
                                                "data",
                                                PrimitiveByteArrayType.INSTANCE,
                                                0,
                                                false,

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Set data_format = "json" and ensure the endpoint returns JSON.
  2. If the API returns non-JSON, put a proxy/transform layer in front that emits JSON, or use a custom source connector.
  3. Check the supported format list in the HTTP source docs; the SPI for other formats is a TODO upstream.

Example fix

// before
source {
  Http {
    data_format = "text"
  }
}
// after
source {
  Http {
    data_format = "json"
  }
}
Defensive patterns

Strategy: validation

Validate before calling

// Only allow json for HttpSource
boolean ok = "json".equalsIgnoreCase(config.getString("data_format"));

Try / catch

try { createSource(config); } catch (HttpConnectorException e) { if (CommonErrorCodeDeprecated.ILLEGAL_ARGUMENT.equals(e.getSeaTunnelErrorCode())) { /* fix data_format */ } }

Prevention

When it happens

Trigger: Setting plugin_output/data_format = "text", "xml", "csv", etc. for an HttpSource; thrown from the default branch of the format switch in the constructor path.

Common situations: Target API returns plain text, HTML, or XML and the user assumes the HTTP source parses it; copying configs from connectors that support more formats.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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