iflytek/astron-agent · error · BusinessException

DATABASE_TABLE_QUERY_FIELD_FAILED

DATABASE_TABLE_QUERY_FIELD_FAILED

Error message

DATABASE_TABLE_QUERY_FIELD_FAILED

What it means

Generic failure thrown by DatabaseService.getDbTableFieldList when paginated field retrieval for a table fails — the outer catch at line 374-376 rethrows any exception as DATABASE_TABLE_QUERY_FIELD_FAILED. The original error (with serialized request params) is logged.

Solutions

  1. Check backend logs for 'Failed to get table field list, params=' for the root cause
  2. Verify pageNum/pageSize are positive integers
  3. Confirm the tbId belongs to the current space (permission check)
  4. Retry after restoring database connectivity

Example fix

// before
{"tbId": 5, "pageNum": 0, "pageSize": -1}
// after
{"tbId": 5, "pageNum": 1, "pageSize": 10}
Defensive patterns

Strategy: validation

Validate before calling

if (vo.getTbId() == null) throw new IllegalArgumentException("tbId required");
if (vo.getPageNum() == null || vo.getPageNum() < 1) vo.setPageNum(1);
if (vo.getPageSize() == null || vo.getPageSize() < 1) vo.setPageSize(10);

Try / catch

try {
    return databaseService.getDbTableFieldList(vo);
} catch (BusinessException e) {
    log.error("field list query failed for tbId={}", vo.getTbId(), e);
    throw e;
}

Prevention

When it happens

Trigger: selectPage on db_table_field fails (DB down, bad SQL), or invalid pagination values in DataBaseSearchVo (pageNum/pageSize) cause MyBatis-Plus pagination plugin errors; checkTbBelong permission failure also surfaces inside/before the try.

Common situations: Calling the field-list endpoint with tbId for a table in another space; pageNum=0 or negative page size breaking the paginator; transient database outage.

Understand the failure class

Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.

Related errors


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

Appendix: source

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

                dbTableVos.add(dbTableVo);
            });
            return dbTableVos;
        } catch (Exception ex) {
            log.error("Failed to get table list, dbId={}", dbId, ex);
            throw new BusinessException(ResponseEnum.DATABASE_TABLE_QUERY_LIST_FAILED);
        }
    }

    public Page<DbTableField> getDbTableFieldList(DataBaseSearchVo dataBaseSearchVo) {
        dataPermissionCheckTool.checkTbBelong(dataBaseSearchVo.getTbId());
        try {
            Page<DbTableField> page = new Page<>(dataBaseSearchVo.getPageNum(), dataBaseSearchVo.getPageSize());
            page = dbTableFieldMapper.selectPage(page, new QueryWrapper<DbTableField>().lambda()
                    .eq(DbTableField::getTbId, dataBaseSearchVo.getTbId()));
            return page;
        } catch (Exception ex) {
            log.error("Failed to get table field list, params={}", JSONObject.toJSONString(dataBaseSearchVo), ex);
            throw new BusinessException(ResponseEnum.DATABASE_TABLE_QUERY_FIELD_FAILED);
        }

    }

    @Transactional
    public void updateTable(DbTableDto dbTableDto) {
        try {
            dataPermissionCheckTool.checkTbBelong(dbTableDto.getId());
            // Update table structure
            DbTable dbTable = dbTableMapper.selectById(dbTableDto.getId());
            String originName = dbTable.getName();
            // Filter system fields id, uid, create_time
            List<String> allowedNames = Arrays.asList(SYSTEM_FIELDS);
            if (dbTableDto.getFields() != null && !dbTableDto.getFields().isEmpty()) {
                // Filter out system fields
                dbTableDto.setFields(dbTableDto.getFields()
                        .stream()
                        .filter(field -> !allowedNames.contains(field.getName()))

View on GitHub (pinned to 5e758547a8)