apache/seatunnel · error · IllegalArgumentException

The Jar package file for the connector is empty!

Error message

The Jar package file for the connector is empty!

What it means

The ConnectorJar constructor validates the serialized jar byte array and throws an IllegalArgumentException when the data is empty (length 0), since shipping a zero-byte jar would produce a broken class loader on target nodes. The type and fileName are additionally null-checked.

Source

Thrown at seatunnel-engine/seatunnel-engine-core/src/main/java/org/apache/seatunnel/engine/core/job/ConnectorJar.java:40

import static org.apache.seatunnel.shade.com.google.common.base.Preconditions.checkNotNull;

public abstract class ConnectorJar implements IdentifiedDataSerializable {

    protected byte[] connectorJarID;

    protected ConnectorJarType type;

    /** The byte buffer storing the actual data. */
    protected byte[] data;

    protected String fileName;

    public ConnectorJar() {}

    protected ConnectorJar(ConnectorJarType type, byte[] data, String fileName) {
        checkNotNull(data);
        if (data.length == 0) {
            throw new IllegalArgumentException("The Jar package file for the connector is empty!");
        }
        checkNotNull(type);
        checkNotNull(fileName);
        this.type = type;
        this.data = data;
        this.fileName = fileName;
    }

    protected ConnectorJar(
            byte[] connectorJarID, ConnectorJarType type, byte[] data, String fileName) {
        checkNotNull(data);
        if (data.length == 0) {
            throw new IllegalArgumentException("The Jar package file for the connector is empty!");
        }
        checkNotNull(connectorJarID);
        checkNotNull(type);
        checkNotNull(fileName);
        this.connectorJarID = connectorJarID;

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Verify the source jar file exists and File.length() > 0 before reading it into the byte array.
  2. Fix the upload/serialization path so the full jar bytes are read (use Files.readAllBytes / IOUtils.toByteArray and check length).
  3. Re-download or re-copy the connector jar if it is corrupted to 0 bytes on disk.
  4. Pass a non-null type and fileName together with the non-empty data when constructing the ConnectorJar.

Example fix

// before
byte[] data = new byte[0];
new SourceConnectorJar(data, "connector-jdbc.jar");
// after
byte[] data = Files.readAllBytes(Paths.get("connectors/connector-jdbc-2.3.8.jar"));
if (data.length == 0) throw new IllegalStateException("jar file is empty");
new SourceConnectorJar(data, "connector-jdbc-2.3.8.jar");
Defensive patterns

Strategy: validation

Validate before calling

byte[] data = Files.readAllBytes(jarPath);
if (data.length == 0) throw new IllegalStateException("connector jar file is empty: " + jarPath);
Objects.requireNonNull(type); Objects.requireNonNull(fileName);

Type guard

boolean isNonEmptyJar(byte[] d) { return d != null && d.length > 0; }

Try / catch

try { new SourceConnectorJar(data, fileName); } catch (IllegalArgumentException e) { log.error("invalid connector jar payload", e); throw e; }

Prevention

When it happens

Trigger: Constructing a ConnectorJar (or subclass like SourceConnectorJar/SinkConnectorJar) with new byte[0] / an empty file's bytes — e.g. reading a connector jar file that is missing or zero-length before calling the constructor.

Common situations: Uploading a connector jar via REST where the client read an empty/nonexistent file; disk full or truncation producing 0-byte jar; reading jar bytes with a stream that returned 0 bytes due to a wrong path.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


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