apache/seatunnel · error · FileConnectorException
CommonErrorCodeDeprecated.UNSUPPORTED_OPERATION
CommonErrorCodeDeprecated.UNSUPPORTED_OPERATION
Error message
User must defined schema for json file type
What it means
JsonReadStrategy cannot infer a schema from JSON files (unlike ORC/Parquet), so getSeaTunnelRowTypeInfo always throws UNSUPPORTED_OPERATION. The library requires the user to explicitly define the schema for JSON file sources. Calling the schema-inference path without a configured schema fails immediately.
Source
Thrown at seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/source/reader/JsonReadStrategy.java:152
seaTunnelRow.setTableId(split.getTableId());
output.collect(seaTunnelRow);
} catch (IOException e) {
String errorMsg =
String.format(
"Deserialize this jsonFile data [%s] failed, please check the origin data",
line);
throw new FileConnectorException(
FileConnectorErrorCode.DATA_DESERIALIZE_FAILED,
errorMsg,
e);
}
});
}
}
@Override
public SeaTunnelRowType getSeaTunnelRowTypeInfo(String path) throws FileConnectorException {
throw new FileConnectorException(
CommonErrorCodeDeprecated.UNSUPPORTED_OPERATION,
"User must defined schema for json file type");
}
}
View on GitHub (pinned to cf67b549a7)
Solutions
- Add a schema block with fields to the JSON file source config.
- If using ReadStrategy API directly, call setSeaTunnelRowTypeInfo(userDefinedRowType) before reading instead of relying on inference.
- Switch to a self-describing format (ORC/Parquet) if you need automatic schema inference.
Example fix
// before
Json {
path = "/data/logs.json"
file_format_type = json
}
// after
Json {
path = "/data/logs.json"
file_format_type = json
schema = {
fields {
id = int
name = string
}
}
} Defensive patterns
Strategy: validation
Validate before calling
// fail fast if schema is absent for json file source
if (fileFormatType == "json" && (schema == null || schema.fields == null)) {
throw new IllegalArgumentException("schema.fields is required for json file sources");
} Type guard
function hasSchema(config) { return config.schema != null && config.schema.fields != null && Object.keys(config.schema.fields).length > 0; } Try / catch
try { rowType = strategy.getSeaTunnelRowTypeInfo(path); } catch (FileConnectorException e) { if (e.getCode() == CommonErrorCodeDeprecated.UNSUPPORTED_OPERATION) { throw new IllegalStateException("Define schema in source config for json files"); } throw e; } Prevention
- Always declare schema { fields { ... } } for json file sources
- Do not reuse ORC/Parquet source templates for json without adding a schema
- Prefer self-describing formats when schema inference is desired
When it happens
Trigger: Calling JsonReadStrategy.getSeaTunnelRowTypeInfo(path); using a JSON file source without setting schema { fields { ... } } so the connector falls back to schema inference from the file.
Common situations: Copy-pasting an ORC/Parquet file source config (which support auto schema) and switching file_type to json; creating a source programmatically without setting the row type; older configs missing the schema block.
Understand the failure class
Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.
Related errors
- INVALID_CONFIG
- AmazonDocumentDB option '' must be a valid BSON/JSON documen
- FIELD_NOT_IN_TABLE
- FileConnectorErrorCode.DATA_DESERIALIZE_FAILED
- FILE_READ_STRATEGY_NOT_SUPPORT
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/e718c8e939579820.
Report an issue: GitHub.