{"record":{"id":"a1430cb2eefe24e3","repo":"iflytek/astron-agent","slug":"database-table-query-field-failed","errorCode":"DATABASE_TABLE_QUERY_FIELD_FAILED","errorMessage":"DATABASE_TABLE_QUERY_FIELD_FAILED","messagePattern":"DATABASE_TABLE_QUERY_FIELD_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":376,"sourceCode":"                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\n    public void updateTable(DbTableDto dbTableDto) {\n        try {\n            dataPermissionCheckTool.checkTbBelong(dbTableDto.getId());\n            // Update table structure\n            DbTable dbTable = dbTableMapper.selectById(dbTableDto.getId());\n            String originName = dbTable.getName();\n            // Filter system fields id, uid, create_time\n            List<String> allowedNames = Arrays.asList(SYSTEM_FIELDS);\n            if (dbTableDto.getFields() != null && !dbTableDto.getFields().isEmpty()) {\n                // Filter out system fields\n                dbTableDto.setFields(dbTableDto.getFields()\n                        .stream()\n                        .filter(field -> !allowedNames.contains(field.getName()))","sourceCodeStart":358,"sourceCodeEnd":394,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/database/DatabaseService.java#L358-L394","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check backend logs for 'Failed to get table field list, params=' for the root cause","Verify pageNum/pageSize are positive integers","Confirm the tbId belongs to the current space (permission check)","Retry after restoring database connectivity"],"exampleFix":"// before\n{\"tbId\": 5, \"pageNum\": 0, \"pageSize\": -1}\n// after\n{\"tbId\": 5, \"pageNum\": 1, \"pageSize\": 10}","handlingStrategy":"validation","validationCode":"if (vo.getTbId() == null) throw new IllegalArgumentException(\"tbId required\");\nif (vo.getPageNum() == null || vo.getPageNum() < 1) vo.setPageNum(1);\nif (vo.getPageSize() == null || vo.getPageSize() < 1) vo.setPageSize(10);","typeGuard":null,"tryCatchPattern":"try {\n    return databaseService.getDbTableFieldList(vo);\n} catch (BusinessException e) {\n    log.error(\"field list query failed for tbId={}\", vo.getTbId(), e);\n    throw e;\n}","preventionTips":["Send positive pageNum/pageSize values","Confirm the table belongs to the current space before querying","Handle transient DB failures with retry/backoff"],"tags":["database","query-failed","pagination"],"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"}