iflytek/astron-agent · error · BusinessException

DATABASE_CANNOT_EMPTY

DATABASE_CANNOT_EMPTY

Error message

DATABASE_CANNOT_EMPTY

What it means

DBTableExcelReadListener.invoke throws BusinessException(DATABASE_CANNOT_EMPTY) when any of the required columns in a data row is null: column 0 (字段名/Field Name), 1 (数据类型/Data Type), 2 (描述/Description), or 4 (是否必填/Required). These four fields are mandatory for each table-field definition row; the Default Value column (3) is the only optional one.

Solutions

  1. Fill in every required column of the row: Field Name, Data Type, Description, and Required (是/否) — Default Value may stay empty.
  2. Remove completely blank rows that Excel may still deliver to the parser.
  3. For Required, explicitly enter 是 or 否 rather than leaving it blank.

Example fix

// before
// age | Integer | (empty desc) | | 是   -> DATABASE_CANNOT_EMPTY
// after
// age | Integer | user age | 0 | 是
Defensive patterns

Strategy: validation

Validate before calling

// pre-flight: required columns 0,1,2,4 must be non-null on every row
boolean rowComplete = row.get(0) != null && row.get(1) != null
        && row.get(2) != null && row.get(4) != null;
if (!rowComplete) throw new IllegalArgumentException("Field Name, Data Type, Description and Required are mandatory");

Try / catch

try {
    EasyExcel.read(file, listener).sheet().doRead();
} catch (BusinessException e) {
    if ("DATABASE_CANNOT_EMPTY".equals(e.getCode())) {
        // report the first row with a missing required cell to the user
    }
}

Prevention

When it happens

Trigger: A data row has an empty cell in columns A, B, C, or E (0-indexed 0,1,2,4); the row exists in Excel but EasyExcel delivers null for truly blank cells; the user left Required blank instead of filling 是/否.

Common situations: Users skip the Description column thinking it optional; leaving the Required column empty; rows with trailing blank cells; partially filled template rows.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


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

Appendix: source

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

        if (!expectedHeadersFormat.equals(actualHeaders)) {
            throw new BusinessException(ResponseEnum.DATABASE_TABLE_FIELD_IMPORT_DEFAULT);
        }
    }

    /**
     * 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);
                }

View on GitHub (pinned to 5e758547a8)