apache/seatunnel · error · java.lang.NullPointerException
Option not be null.
Error message
Option not be null.
What it means
While reading with POI, ExcelReadStrategy computes startRow = firstRowNum + skipHeaderNumber. If that start row is beyond the sheet's lastRowNum, there are no data rows left to read, and it throws FileConnectorException with UNSUPPORTED_OPERATION. It protects against a skip-header-row-number that exceeds the sheet's row count.
Source
Thrown at seatunnel-api/src/main/java/org/apache/seatunnel/api/configuration/ReadonlyConfig.java:105
return result;
}
public void toMap(Map<String, String> result) {
if (confData.isEmpty()) {
return;
}
for (Map.Entry<String, Object> entry : confData.entrySet()) {
result.put(entry.getKey(), convertToJsonString(entry.getValue()));
}
}
public Map<String, Object> getSourceMap() {
return confData;
}
public <T> Optional<T> getOptional(Option<T> option) {
if (option == null) {
throw new NullPointerException("Option not be null.");
}
Object value = getValue(option.key());
if (value == null) {
for (String fallbackKey : option.getFallbackKeys()) {
value = getValue(fallbackKey);
if (value != null) {
log.warn(
"Please use the new key '{}' instead of the deprecated key '{}'.",
option.key(),
fallbackKey);
break;
}
}
}
if (value == null) {
return Optional.empty();
}
return Optional.of(convertValue(value, option));View on GitHub (pinned to cf67b549a7)
Solutions
- Lower skip_header_row_number so it is strictly less than the number of rows in every matched sheet.
- Remove the nearly empty file from the source path or move it out of the matched directory.
- Pre-check each Excel file's row count before the job and validate it against the configured skip value.
Example fix
// before skip_header_row_number = 5 // sheet only has 3 rows // after skip_header_row_number = 1
Defensive patterns
Strategy: validation
Validate before calling
java
// Before the job: ensure sheet has more rows than skip count
int lastRowNum = sheet.getLastRowNum();
if (skipHeaderRowNumber >= lastRowNum + 1) {
throw new IllegalArgumentException("skip_header_row_number=" + skipHeaderRowNumber
+ " exceeds rows in sheet (lastRowNum=" + lastRowNum + ")");
} Try / catch
java
try {
reader.readProcess(split);
} catch (FileConnectorException e) {
if (e.getMessage().contains("Skip the number of rows exceeds")) {
LOG.error("skip_header_row_number too large for file {} — lower it or exclude the file", split.getPath(), e);
}
} Prevention
- Verify each matched sheet's row count when reusing skip_header_row_number across files
- Exclude empty or header-only Excel files from the source path
- Remember the skip value applies to every sheet/file the job reads
When it happens
Trigger: readByPoi is called on a sheet whose (lastRowNum - firstRowNum + 1) is less than or equal to the configured skip_header_row_number, e.g. skipping 5 header rows on a sheet with only 3 rows, or on an effectively empty sheet.
Common situations: A shared skip_header_row_number value reused across files where some sheets are nearly empty; miscounting header rows; the pipeline picked up a truncated or header-only Excel file.
Understand the failure class
Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.
Related errors
- Condition operator must not be null
- prepare method is not supported
- Json parsing exception.
- Condition option must not be null
- Operator EXTENSION requires a non-null ConditionExtension
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/78de8569697d43a0.
Report an issue: GitHub.