apache/seatunnel · error · FileConnectorException

COMMON_ERROR_CODE-11

COMMON_ERROR_CODE-11

Error message

User must defined schema for xml file type

What it means

XmlReadStrategy requires the user to declare the schema explicitly via a catalog table (schema in the config). getSeaTunnelRowTypeInfo is the path-inferred-schema hook, and XML inference is not implemented, so it unconditionally throws UNSUPPORTED_OPERATION.

Source

Thrown at seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/source/reader/XmlReadStrategy.java:221

            saxReader.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
            saxReader.setFeature(DISALLOW_DOCTYPE_DECL, true);
            saxReader.setFeature(EXTERNAL_GENERAL_ENTITIES, false);
            saxReader.setFeature(EXTERNAL_PARAMETER_ENTITIES, false);
            saxReader.setFeature(LOAD_EXTERNAL_DTD, false);
            saxReader.setEntityResolver(
                    (publicId, systemId) -> new InputSource(new StringReader("")));
        } catch (SAXException e) {
            throw new FileConnectorException(
                    FileConnectorErrorCode.FILE_READ_FAILED,
                    "Failed to initialize secure XML parser while reading file [" + filePath + "]",
                    e);
        }
        return saxReader;
    }

    @Override
    public SeaTunnelRowType getSeaTunnelRowTypeInfo(String path) throws FileConnectorException {
        throw new FileConnectorException(
                CommonErrorCodeDeprecated.UNSUPPORTED_OPERATION,
                "User must defined schema for xml file type");
    }

    @Override
    public void setCatalogTable(CatalogTable catalogTable) {
        SeaTunnelRowType rowType = catalogTable.getSeaTunnelRowType();
        if (ArrayUtils.isEmpty(rowType.getFieldNames())
                || ArrayUtils.isEmpty(rowType.getFieldTypes())) {
            throw new FileConnectorException(
                    CommonErrorCodeDeprecated.ILLEGAL_ARGUMENT,
                    "Schema information is undefined or misconfigured, please check your configuration file.");
        }

        String partitionPath = getPathForPartitionInference(null);
        if (readColumns.isEmpty()) {
            this.seaTunnelRowType = rowType;
            this.seaTunnelRowTypeWithPartition = mergePartitionTypes(partitionPath, rowType);

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Define the schema explicitly in the source config (schema.fields with name/type) so setCatalogTable is used instead of inference.
  2. Switch to a format that supports schema inference (e.g. JSON/CSV) if explicit schema is not desired.
  3. Upgrade SeaTunnel if a newer version supports XML schema inference.

Example fix

// before
source {
  LocalFile {
    file_format_type = "xml"
  }
}
// after
source {
  LocalFile {
    file_format_type = "xml"
    schema = {
      fields {
        id = int
        name = string
      }
    }
  }
}
Defensive patterns

Strategy: validation

Validate before calling

if (config.getFileFormatType().equalsIgnoreCase("xml") && (config.getSchema() == null || config.getSchema().isEmpty())) {
    throw new IllegalArgumentException("XML file source requires an explicit schema block");
}

Type guard

boolean hasSchema(Config c) { return c.hasPath("schema.fields") && !c.getConfig("schema.fields").isEmpty(); }

Prevention

When it happens

Trigger: A SeaTunnel XML file source runs without a user-defined schema, so the framework calls getSeaTunnelRowTypeInfo(path) to auto-derive the row type from the file.

Common situations: Users coming from JSON/CSV sources assume schema auto-inference works for XML files too and omit the schema block in their source config.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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