iflytek/astron-agent · error · BusinessException

DATABASE_TABLE_QUERY_LIST_FAILED

DATABASE_TABLE_QUERY_LIST_FAILED

Error message

DATABASE_TABLE_QUERY_LIST_FAILED

What it means

Generic failure thrown by DatabaseService.getDbTableList when any exception occurs while querying the table list — the outer catch (Exception) at line 361-364 rethrows as DATABASE_TABLE_QUERY_LIST_FAILED. The original exception is logged with dbId for diagnosis.

Solutions

  1. Check backend logs for 'Failed to get table list, dbId=' for the root cause
  2. Verify the console backend can reach its metadata database
  3. Confirm the dbId belongs to the current space (permission check)
  4. Retry after restoring database connectivity
Defensive patterns

Strategy: try-catch

Validate before calling

if (dbId == null) throw new IllegalArgumentException("dbId required");
// also verify the db belongs to the current space before calling
dataPermissionCheckTool.checkDbBelong(dbId);

Try / catch

try {
    return databaseService.getDbTableList(dbId);
} catch (BusinessException e) {
    log.error("table list query failed for dbId={}", dbId, e);
    return Collections.emptyList(); // or rethrow per policy
}

Prevention

When it happens

Trigger: Database connectivity issues, MyBatis query failure on db_table, data-permission check (checkDbBelong) throwing, or mapping errors while copying DbTable rows to DbTableVo via BeanUtils.

Common situations: Backend DB connection pool exhausted or DB down; a corrupted row fails BeanUtils copy; permission check fails because the dbId belongs to another space/tenant.

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/ec8a54a6297760d3. Report an issue: GitHub.

Appendix: source

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

        try {
            if (dbId == null) {
                throw new BusinessException(ResponseEnum.DATABASE_ID_CANNOT_EMPTY);
            }
            dataPermissionCheckTool.checkDbBelong(dbId);
            List<DbTable> dbTables = dbTableMapper.selectList(new QueryWrapper<DbTable>().lambda()
                    .eq(DbTable::getDbId, dbId)
                    .orderByDesc(DbTable::getCreateTime)
                    .eq(DbTable::getDeleted, false));
            List<DbTableVo> dbTableVos = new ArrayList<>();
            dbTables.forEach(dbTable -> {
                DbTableVo dbTableVo = new DbTableVo();
                BeanUtils.copyProperties(dbTable, dbTableVo);
                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

View on GitHub (pinned to 5e758547a8)