iflytek/astron-agent · error · BusinessException
DATABASE_TYPE_ILLEGAL
DATABASE_TYPE_ILLEGAL
Error message
DATABASE_TYPE_ILLEGAL
What it means
DBTableExcelReadListener.invoke throws BusinessException(DATABASE_TYPE_ILLEGAL) when the Data Type column (index 1) contains a value not in the allowed set: String, Integer, Time, Number, Boolean. The check is exact case-sensitive contains() on the raw cell string, so "integer", "INT", or "Long" all fail even though Integer comparison elsewhere uses equalsIgnoreCase.
Solutions
- Set the Data Type cell to exactly one of: String, Integer, Time, Number, Boolean (capitalized as shown).
- Replace SQL-native type names (INT, VARCHAR, DECIMAL) with the closest supported type.
- Trim whitespace from the Data Type cell (e.g., "Integer " fails the exact match).
Example fix
// before // age | int | user age | | 是 -> DATABASE_TYPE_ILLEGAL // after // age | Integer | user age | | 是
Defensive patterns
Strategy: validation
Validate before calling
// pre-flight: Data Type must be exactly one of the supported values
List<String> allowed = List.of("String", "Integer", "Time", "Number", "Boolean");
String t = row.get(1) == null ? "" : row.get(1).trim();
if (!allowed.contains(t)) throw new IllegalArgumentException("Unsupported data type: " + row.get(1)); Try / catch
try {
EasyExcel.read(file, listener).sheet().doRead();
} catch (BusinessException e) {
if ("DATABASE_TYPE_ILLEGAL".equals(e.getCode())) {
// show the allowed type list to the user
}
} Prevention
- Pick types only from the template dropdown: String, Integer, Time, Number, Boolean.
- Map SQL-native types (INT, VARCHAR, DATETIME) to the closest supported type.
- Trim the cell and use exact capitalization ("integer" fails).
When it happens
Trigger: A row's Data Type cell contains an unsupported type like "Text", "Long", "Decimal", "int", "datetime", or a lowercase/typo variant such as "integer" or "string" (case-sensitive check); cell has trailing whitespace making it not exactly match.
Common situations: Users familiar with SQL write native types (VARCHAR, INT, DATETIME); autocorrect capitalization in Excel; trailing spaces from copy-paste.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- Header mismatch! Expected headers: , Actual headers:
- DATABASE_CANNOT_EMPTY
- DATABASE_TABLE_ILLEGAL_DEFAULT
- 8309
- Invalid publish type format
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/74625f0dd6595fc4.
Report an issue: GitHub.
Appendix: source
Thrown at console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/database/DBTableExcelReadListener.java:78
/**
* Parse and validate each row, then convert to {@link DbTableFieldDto}.
*
* @param row the row data, key is column index, value is cell content
* @param context analysis context
* @throws BusinessException if required fields are empty, type is illegal, or default value is
* invalid
*/
@Override
public void invoke(Map<Integer, String> row, AnalysisContext context) {
// Validate required fields are not empty
DbTableFieldDto dbTableFieldDto = new DbTableFieldDto();
if (row.get(0) == null || row.get(1) == null || row.get(2) == null || row.get(4) == null) {
throw new BusinessException(ResponseEnum.DATABASE_CANNOT_EMPTY);
}
dbTableFieldDto.setName(row.get(0));
if (!fieldType.contains(row.get(1))) {
throw new BusinessException(ResponseEnum.DATABASE_TYPE_ILLEGAL);
}
dbTableFieldDto.setType(row.get(1));
dbTableFieldDto.setDescription(row.get(2));
if (StringUtils.isNotBlank(row.get(3))) {
if ("Integer".equalsIgnoreCase(row.get(1))) {
try {
Long.parseLong(row.get(3));
} catch (NumberFormatException e) {
throw new BusinessException(ResponseEnum.DATABASE_TABLE_ILLEGAL_DEFAULT);
}
} else if ("Boolean".equalsIgnoreCase(row.get(1))) {
if (!"true".equalsIgnoreCase(row.get(3)) && !"false".equalsIgnoreCase(row.get(3))) {
throw new BusinessException(ResponseEnum.DATABASE_TABLE_ILLEGAL_DEFAULT);
}
} else if ("Number".equalsIgnoreCase(row.get(1))) {
try {
Double.parseDouble(row.get(3));
} catch (NumberFormatException e) {View on GitHub (pinned to 5e758547a8)