apache/seatunnel · error · FileConnectorException

CONFIG_VALIDATION_FAILED

CONFIG_VALIDATION_FAILED

Error message

Mandatory configurations '%s' and '%s' must be specified when reading XML files.

What it means

XmlReadStrategy.preCheckAndInitializeConfiguration (called from init) validates that both mandatory XML options — xml_field_row_tag (XML_ROW_TAG) and xml_use_attribute_format (XML_USE_ATTR_FORMAT) — are set. Missing either raises CONFIG_VALIDATION_FAILED.

Source

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

                throw new FileConnectorException(
                        CommonErrorCodeDeprecated.UNSUPPORTED_DATA_TYPE,
                        String.format("Unsupported data type: %s", sqlType));
        }
    }

    private String getXPathExpression(String tableRowIdentification) {
        return String.format("//%s", tableRowIdentification);
    }

    /** Performs pre-checks and initialization of the configuration for reading XML files. */
    private void preCheckAndInitializeConfiguration() {
        ReadonlyConfig readonlyConfig = ReadonlyConfig.fromConfig(pluginConfig);
        this.tableRowName = readonlyConfig.get(FileBaseSourceOptions.XML_ROW_TAG);
        this.useAttrFormat = readonlyConfig.get(FileBaseSourceOptions.XML_USE_ATTR_FORMAT);

        // Check mandatory configurations
        if (StringUtils.isEmpty(tableRowName) || useAttrFormat == null) {
            throw new FileConnectorException(
                    SeaTunnelAPIErrorCode.CONFIG_VALIDATION_FAILED,
                    String.format(
                            "Mandatory configurations '%s' and '%s' must be specified when reading XML files.",
                            FileBaseSourceOptions.XML_ROW_TAG.key(),
                            FileBaseSourceOptions.XML_USE_ATTR_FORMAT.key()));
        }

        this.delimiter = readonlyConfig.get(FileBaseSourceOptions.FIELD_DELIMITER);

        this.dateFormat =
                getComplexDateConfigValue(
                        FileBaseSourceOptions.DATE_FORMAT_LEGACY, DateUtils.Formatter::parse);
        this.timeFormat =
                getComplexDateConfigValue(
                        FileBaseSourceOptions.TIME_FORMAT_LEGACY, TimeUtils.Formatter::parse);
        this.datetimeFormat =
                getComplexDateConfigValue(
                        FileBaseSourceOptions.DATETIME_FORMAT_LEGACY,

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Add xml_field_row_tag = "<row-tag>" to the source config.
  2. Add xml_use_attribute_format = true|false to the source config.
  3. Verify option key spelling against FileBaseSourceOptions (xml_field_row_tag, xml_use_attribute_format).

Example fix

// before
LocalFile {
  file_format_type = "xml"
}
// after
LocalFile {
  file_format_type = "xml"
  xml_field_row_tag = "record"
  xml_use_attribute_format = false
}
Defensive patterns

Strategy: validation

Validate before calling

if (!config.hasPath("xml_field_row_tag") || !config.hasPath("xml_use_attribute_format")) {
  throw new IllegalArgumentException("xml_field_row_tag and xml_use_attribute_format are required for xml format");
}

Try / catch

try {
  source.prepare(config);
} catch (FileConnectorException e) {
  if (e.getMessage().contains("Mandatory configurations")) {
    throw new ConfigException("Add xml_field_row_tag and xml_use_attribute_format", e);
  }
  throw e;
}

Prevention

When it happens

Trigger: Source config omits the XML row tag name or the use-attribute-format boolean while file_format_type=xml.

Common situations: Copying a JSON/CSV file-source config and switching file_format_type to xml without adding XML-specific keys; typo in the option key.

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


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