iflytek/astron-agent · error · IllegalArgumentException
No valid data in file, please check if excel data is…
Error message
No valid data in file, please check if excel data is correct!
What it means
DBExcelReadListener.doAfterAllAnalysed throws this IllegalArgumentException when the entire sheet was parsed but zero rows were accepted (accepted == 0). The import completed without any usable data rows, so the operation is rejected as an empty import. It only fires when all rows were skipped, invalid, or absent — rows beyond maxRows are silently ignored, but the first accepted row would prevent this.
Solutions
- Add at least one valid data row under the header before importing.
- Verify the correct worksheet/sheet index is being read (the sheet containing data, not an empty one).
- Check that data cell values conform to field types (Integer/Number/Boolean/Time) so rows parse instead of aborting mid-invoke.
Example fix
// before: template file uploaded with header only -> no rows // after: fill at least one row, e.g. // name | type | description | default | required // age | Integer | user age | 0 | 是
Defensive patterns
Strategy: validation
Validate before calling
// pre-flight: count non-empty data rows before import
try (var wb = org.apache.poi.ss.usermodel.WorkbookFactory.create(inputStream)) {
var sheet = wb.getSheetAt(0);
boolean hasData = sheet.getRowIterator().hasNext()
&& sheet.getRow(0) != null && sheet.getLastRowNum() >= 1;
if (!hasData) throw new IllegalArgumentException("File contains no data rows");
} Try / catch
try {
EasyExcel.read(file, listener).sheet().doRead();
} catch (IllegalArgumentException e) {
if (e.getMessage().contains("No valid data in file")) {
// show user-facing message: add at least one data row
}
} Prevention
- Fill at least one data row before importing.
- Confirm the active sheet is the one with data (no extra empty sheets first).
- Validate cell values against field types so rows parse successfully.
When it happens
Trigger: Uploading an Excel file containing only the header row with no data rows; a file where every row failed to parse before being added (e.g., cell values that throw inside invoke before accepted++ such as Long.parseLong failures); a file whose sheet selection points at an empty sheet.
Common situations: Users submit the template file unchanged without adding any data; wrong sheet is active so the populated data lives on another sheet; all data rows contain unparseable values that abort parsing before incrementing accepted.
Understand the failure class
Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.
Related errors
- No field information found, please check if the data is…
- Header mismatch! Expected headers: , Actual headers:
- RESPONSE_FAILED
- Unable to parse boolean value: '
- DATABASE_TABLE_FIELD_IMPORT_DEFAULT
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/ebe79c7b985545e3.
Report an issue: GitHub.
Appendix: source
Thrown at console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/database/DBExcelReadListener.java:111
Object v;
if (StringUtils.isBlank(raw)) {
// Null value: required -> use field default value; not required -> type default value (or null)
v = chooseDefault(meta, notNullFieldsList.contains(header));
} else {
v = parseByType(raw, meta.getType());
}
out.put(header, v);
}
rowsSink.add(out);
accepted++;
}
@Override
public void doAfterAllAnalysed(AnalysisContext analysisContext) {
if (accepted == 0) {
throw new IllegalArgumentException("No valid data in file, please check if excel data is correct!");
}
}
// Helper: Parse and default values
private Object parseByType(String s, String type) {
String t = StringUtils.lowerCase(type);
switch (t) {
case CommonConst.DBFieldType.INTEGER:
return Long.parseLong(s.trim());
case CommonConst.DBFieldType.NUMBER:
return new BigDecimal(s.trim());
case CommonConst.DBFieldType.BOOLEAN:
return parseBoolean(s);
case CommonConst.DBFieldType.TIME:
// Require standard format to avoid ambiguity in smart parsing
return LocalDateTime.parse(s.trim(), TS);
default:View on GitHub (pinned to 5e758547a8)