{"record":{"id":"d8da7f2f20f724b9","repo":"apache/seatunnel","slug":"the-jar-package-file-for-the-connector-is-empty","errorCode":null,"errorMessage":"The Jar package file for the connector is empty!","messagePattern":"The Jar package file for the connector is empty!","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"seatunnel-engine/seatunnel-engine-core/src/main/java/org/apache/seatunnel/engine/core/job/ConnectorJar.java","lineNumber":40,"sourceCode":"import static org.apache.seatunnel.shade.com.google.common.base.Preconditions.checkNotNull;\n\npublic abstract class ConnectorJar implements IdentifiedDataSerializable {\n\n    protected byte[] connectorJarID;\n\n    protected ConnectorJarType type;\n\n    /** The byte buffer storing the actual data. */\n    protected byte[] data;\n\n    protected String fileName;\n\n    public ConnectorJar() {}\n\n    protected ConnectorJar(ConnectorJarType type, byte[] data, String fileName) {\n        checkNotNull(data);\n        if (data.length == 0) {\n            throw new IllegalArgumentException(\"The Jar package file for the connector is empty!\");\n        }\n        checkNotNull(type);\n        checkNotNull(fileName);\n        this.type = type;\n        this.data = data;\n        this.fileName = fileName;\n    }\n\n    protected ConnectorJar(\n            byte[] connectorJarID, ConnectorJarType type, byte[] data, String fileName) {\n        checkNotNull(data);\n        if (data.length == 0) {\n            throw new IllegalArgumentException(\"The Jar package file for the connector is empty!\");\n        }\n        checkNotNull(connectorJarID);\n        checkNotNull(type);\n        checkNotNull(fileName);\n        this.connectorJarID = connectorJarID;","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-engine/seatunnel-engine-core/src/main/java/org/apache/seatunnel/engine/core/job/ConnectorJar.java#L22-L58","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the source jar file exists and File.length() > 0 before reading it into the byte array.","Fix the upload/serialization path so the full jar bytes are read (use Files.readAllBytes / IOUtils.toByteArray and check length).","Re-download or re-copy the connector jar if it is corrupted to 0 bytes on disk.","Pass a non-null type and fileName together with the non-empty data when constructing the ConnectorJar."],"exampleFix":"// before\nbyte[] data = new byte[0];\nnew SourceConnectorJar(data, \"connector-jdbc.jar\");\n// after\nbyte[] data = Files.readAllBytes(Paths.get(\"connectors/connector-jdbc-2.3.8.jar\"));\nif (data.length == 0) throw new IllegalStateException(\"jar file is empty\");\nnew SourceConnectorJar(data, \"connector-jdbc-2.3.8.jar\");","handlingStrategy":"validation","validationCode":"byte[] data = Files.readAllBytes(jarPath);\nif (data.length == 0) throw new IllegalStateException(\"connector jar file is empty: \" + jarPath);\nObjects.requireNonNull(type); Objects.requireNonNull(fileName);","typeGuard":"boolean isNonEmptyJar(byte[] d) { return d != null && d.length > 0; }","tryCatchPattern":"try { new SourceConnectorJar(data, fileName); } catch (IllegalArgumentException e) { log.error(\"invalid connector jar payload\", e); throw e; }","preventionTips":["Check File.length() before reading jar bytes for upload.","Handle upload errors so a failed read never serializes an empty payload.","Monitor disk space; 0-byte files often indicate a full disk or truncated transfer."],"tags":["connector-jar","validation","zeta-engine"],"backgroundTag":"empty-required-field","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T21:17:11.552Z"}