iflytek/astron-agent · error · BusinessException

DATABASE_TABLE_FIELD_IMPORT_DEFAULT

DATABASE_TABLE_FIELD_IMPORT_DEFAULT

Error message

DATABASE_TABLE_FIELD_IMPORT_DEFAULT

What it means

DBTableExcelReadListener.invokeHeadMap throws BusinessException(DATABASE_TABLE_FIELD_IMPORT_DEFAULT) when the first row of the uploaded Excel does not exactly match the expected header list — Chinese headers (字段名*, 数据类型*, 描述*, 默认值, 是否必填*) when LanguageContext is not English, or English headers (Field Name*, Data Type*, Description*, Default Value, Required*) when it is. The comparison is strict ordered equality, so any rename, reorder, extra, or missing column fails.

Solutions

  1. Re-download the import template from the UI matching the current interface language and import it unmodified.
  2. Restore the exact header row: 字段名*, 数据类型*, 描述*, 默认值, 是否必填* (or the English equivalents), in that order, with no extra columns.
  3. Check the session/request language context (LanguageContext) matches the template language being uploaded.

Example fix

// before (header row)
// name | type | desc | default | required
// after (exact template headers)
// 字段名* | 数据类型* | 描述* | 默认值 | 是否必填*
Defensive patterns

Strategy: validation

Validate before calling

// pre-flight header check against the template for the active language
List<String> expected = LanguageContext.isEn()
    ? List.of("Field Name*", "Data Type*", "Description*", "Default Value", "Required*")
    : List.of("字段名*", "数据类型*", "描述*", "默认值", "是否必填*");
// read row 0 and compare with expected.equals(actualHeaders) before invoking the listener

Try / catch

try {
    EasyExcel.read(file, listener).sheet().doRead();
} catch (BusinessException e) {
    if ("DATABASE_TABLE_FIELD_IMPORT_DEFAULT".equals(e.getCode())) {
        // instruct user to re-download the template for their UI language
    }
}

Prevention

When it happens

Trigger: Uploading a table-field import template whose header row was edited, translated, or reordered; the file uses Chinese headers while the session language context is English (or vice versa); extra leading/trailing columns or whitespace in header cells.

Common situations: Users modify or delete template headers; a template from a different locale (Chinese vs English UI) is uploaded; headers copied with extra spaces; columns rearranged in Excel.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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

Appendix: source

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

    /**
     * Validate header format before parsing rows.
     *
     * @param headMap the header map from Excel
     * @param context analysis context
     * @throws BusinessException if the header format does not match expected
     */
    @Override
    public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) {
        List<String> actualHeaders = new ArrayList<>(headMap.values());
        List<String> expectedHeadersFormat;
        if (LanguageContext.isEn()) {
            expectedHeadersFormat = expectedHeadersEn;
        } else {
            expectedHeadersFormat = expectedHeaders;
        }
        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);
        }

View on GitHub (pinned to 5e758547a8)