{"record":{"id":"ec8a54a6297760d3","repo":"iflytek/astron-agent","slug":"database-table-query-list-failed","errorCode":"DATABASE_TABLE_QUERY_LIST_FAILED","errorMessage":"DATABASE_TABLE_QUERY_LIST_FAILED","messagePattern":"DATABASE_TABLE_QUERY_LIST_FAILED","errorType":"error_code","errorClass":"BusinessException","httpStatus":null,"severity":"error","filePath":"console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/database/DatabaseService.java","lineNumber":363,"sourceCode":"        try {\n            if (dbId == null) {\n                throw new BusinessException(ResponseEnum.DATABASE_ID_CANNOT_EMPTY);\n            }\n            dataPermissionCheckTool.checkDbBelong(dbId);\n            List<DbTable> dbTables = dbTableMapper.selectList(new QueryWrapper<DbTable>().lambda()\n                    .eq(DbTable::getDbId, dbId)\n                    .orderByDesc(DbTable::getCreateTime)\n                    .eq(DbTable::getDeleted, false));\n            List<DbTableVo> dbTableVos = new ArrayList<>();\n            dbTables.forEach(dbTable -> {\n                DbTableVo dbTableVo = new DbTableVo();\n                BeanUtils.copyProperties(dbTable, dbTableVo);\n                dbTableVos.add(dbTableVo);\n            });\n            return dbTableVos;\n        } catch (Exception ex) {\n            log.error(\"Failed to get table list, dbId={}\", dbId, ex);\n            throw new BusinessException(ResponseEnum.DATABASE_TABLE_QUERY_LIST_FAILED);\n        }\n    }\n\n    public Page<DbTableField> getDbTableFieldList(DataBaseSearchVo dataBaseSearchVo) {\n        dataPermissionCheckTool.checkTbBelong(dataBaseSearchVo.getTbId());\n        try {\n            Page<DbTableField> page = new Page<>(dataBaseSearchVo.getPageNum(), dataBaseSearchVo.getPageSize());\n            page = dbTableFieldMapper.selectPage(page, new QueryWrapper<DbTableField>().lambda()\n                    .eq(DbTableField::getTbId, dataBaseSearchVo.getTbId()));\n            return page;\n        } catch (Exception ex) {\n            log.error(\"Failed to get table field list, params={}\", JSONObject.toJSONString(dataBaseSearchVo), ex);\n            throw new BusinessException(ResponseEnum.DATABASE_TABLE_QUERY_FIELD_FAILED);\n        }\n\n    }\n\n    @Transactional","sourceCodeStart":345,"sourceCodeEnd":381,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/database/DatabaseService.java#L345-L381","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check backend logs for 'Failed to get table list, dbId=' for the root cause","Verify the console backend can reach its metadata database","Confirm the dbId belongs to the current space (permission check)","Retry after restoring database connectivity"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if (dbId == null) throw new IllegalArgumentException(\"dbId required\");\n// also verify the db belongs to the current space before calling\ndataPermissionCheckTool.checkDbBelong(dbId);","typeGuard":null,"tryCatchPattern":"try {\n    return databaseService.getDbTableList(dbId);\n} catch (BusinessException e) {\n    log.error(\"table list query failed for dbId={}\", dbId, e);\n    return Collections.emptyList(); // or rethrow per policy\n}","preventionTips":["Keep the metadata database connection healthy (pool sizing, timeouts)","Ensure space/permission setup so checkDbBelong passes","Retry transient DB outages with backoff"],"tags":["database","query-failed","read"],"backgroundTag":"database-query-failed","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-19T12:17:13.211Z"}