{"record":{"id":"d625af6e01d6f0cf","repo":"apache/seatunnel","slug":"binary-chunk-size-must-be-positive-got-s","errorCode":null,"errorMessage":"Binary chunk size must be positive, got: %s","messagePattern":"Binary chunk size must be positive, got: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/source/reader/BinaryReadStrategy.java","lineNumber":78,"sourceCode":"    public void init(HadoopConf conf) {\n        super.init(conf);\n        basePath = pluginConfig.getString(FileBaseSourceOptions.FILE_PATH.key());\n        try {\n            basePathIsFile = hadoopFileSystemProxy.isFile(basePath);\n        } catch (IOException e) {\n            throw new FileConnectorException(\n                    SeaTunnelAPIErrorCode.CONFIG_VALIDATION_FAILED,\n                    \"Failed to determine whether file source path is a file or directory: \"\n                            + basePath,\n                    e);\n        }\n\n        // Load binary chunk size configuration\n        if (pluginConfig.hasPath(FileBaseSourceOptions.BINARY_CHUNK_SIZE.key())) {\n            binaryChunkSize = pluginConfig.getInt(FileBaseSourceOptions.BINARY_CHUNK_SIZE.key());\n            // Validate chunk size - should be positive and reasonable\n            if (binaryChunkSize <= 0) {\n                throw new IllegalArgumentException(\n                        \"Binary chunk size must be positive, got: \" + binaryChunkSize);\n            }\n            if (binaryChunkSize > 100 * 1024 * 1024) { // 100MB limit\n                throw new IllegalArgumentException(\n                        \"Binary chunk size too large (max 100MB), got: \" + binaryChunkSize);\n            }\n        }\n\n        // Load complete file mode configuration\n        if (pluginConfig.hasPath(FileBaseSourceOptions.BINARY_COMPLETE_FILE_MODE.key())) {\n            completeFileMode =\n                    pluginConfig.getBoolean(FileBaseSourceOptions.BINARY_COMPLETE_FILE_MODE.key());\n        }\n    }\n\n    @Override\n    public void read(String path, String tableId, Collector<SeaTunnelRow> output)\n            throws IOException, FileConnectorException {","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-file/connector-file-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/source/reader/BinaryReadStrategy.java#L60-L96","documentation":"BinaryReadStrategy.init reads the optional binary_chunk_size option and validates that it is a positive integer. Values <= 0 would break chunked reads (infinite loop or no progress), so a plain IllegalArgumentException is thrown immediately with the offending value.","triggerScenarios":"Configuring binary_chunk_size = 0 or a negative integer (e.g. -1024) in the file source config before a binary read.","commonSituations":"Users attempting to 'disable' chunking by setting 0; sign errors in generated configs; unit confusion expecting the value in KB instead of bytes.","solutions":["Set binary_chunk_size to a positive integer number of bytes, e.g. 8192.","Remove the option to use the connector default chunk size.","If the intent was a small value, use at least 1 byte; realistically use a few KB or more."],"exampleFix":"// before\nbinary_chunk_size = 0\n// after\nbinary_chunk_size = 8192","handlingStrategy":"validation","validationCode":"// Java\nint chunk = config.getInt(\"binary_chunk_size\", DEFAULT_CHUNK);\nif (chunk <= 0) {\n    throw new IllegalArgumentException(\"binary_chunk_size must be positive, got: \" + chunk);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never set binary_chunk_size to 0 or negatives; omit the key for defaults.","Remember the unit is bytes.","Add config linting for positive integer constraints."],"tags":["config-validation","binary","validation"],"backgroundTag":"argument-out-of-range","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}