iflytek/astron-agent · error · BusinessException

DATABASE_TABLE_ILLEGAL_DEFAULT

DATABASE_TABLE_ILLEGAL_DEFAULT

Error message

DATABASE_TABLE_ILLEGAL_DEFAULT

What it means

DBTableExcelReadListener.invoke throws BusinessException(DATABASE_TABLE_ILLEGAL_DEFAULT) when a row's Default Value (column 3) is non-blank but the field type is Integer and the value cannot be parsed with Long.parseLong. Each type has a default-value format check; this is the Integer branch, triggered by NumberFormatException.

Solutions

  1. Change the default value to a plain integer literal within Long range, e.g. 0 or 42.
  2. If the default genuinely needs a fraction, change the field type to Number (parsed with Double.parseDouble) instead of Integer.
  3. Remove the default value entirely (leave column 3 blank) since Default Value is optional.

Example fix

// before
// count | Integer | hit count | 1.5 | 是 -> DATABASE_TABLE_ILLEGAL_DEFAULT
// after
// count | Integer | hit count | 0 | 是
Defensive patterns

Strategy: validation

Validate before calling

// pre-flight: Integer default values must parse as a long
if ("Integer".equalsIgnoreCase(row.get(1)) && row.get(3) != null && !row.get(3).isBlank()) {
    try { Long.parseLong(row.get(3).trim()); }
    catch (NumberFormatException e) { throw new IllegalArgumentException("Integer default must be a whole number: " + row.get(3)); }
}

Try / catch

try {
    EasyExcel.read(file, listener).sheet().doRead();
} catch (BusinessException e) {
    if ("DATABASE_TABLE_ILLEGAL_DEFAULT".equals(e.getCode())) {
        // flag the Default Value cell of the Integer-typed row
    }
}

Prevention

When it happens

Trigger: An Integer-typed row has a default value like "abc", "1.5", "12,000", "", a value exceeding Long range, or any non-integer text.

Common situations: Users enter decimal or comma-formatted numbers as integer defaults; unit suffixes like "100ms"; large numbers beyond Long.MAX_VALUE.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12). Data as JSON: /api/errors/bb1e803f63185043. Report an issue: GitHub.

Appendix: source

Thrown at console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/database/DBTableExcelReadListener.java:87

    @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) {
                    throw new BusinessException(ResponseEnum.DATABASE_TABLE_ILLEGAL_DEFAULT);
                }
            }
        }
        dbTableFieldDto.setDefaultValue(row.get(3));
        dbTableFieldDto.setIsRequired("是".equals(row.get(4)));
        tableFields.add(dbTableFieldDto);
    }

View on GitHub (pinned to 5e758547a8)