{"record":{"id":"657d9f91047e7504","repo":"iflytek/astron-agent","slug":"database-table-create-failed","errorCode":"DATABASE_TABLE_CREATE_FAILED","errorMessage":"DATABASE_TABLE_CREATE_FAILED","messagePattern":"DATABASE_TABLE_CREATE_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":338,"sourceCode":"                    }\n                    dbTableField.setIsSystem(false);\n                }\n                dbTableField.setTbId(dbTable.getId());\n                dbTableField.setCreateTime(new Date());\n                dbTableField.setUpdateTime(new Date());\n                fields.add(dbTableField);\n            }\n            dbTableFieldMapper.insertBatch(fields);\n            // Save to core system\n            String ddl = buildDDL(dbTableDto, DBOperateEnum.INSERT.getCode(), null);\n            // Call core system to create table\n            for (String stmt : safeSplitStatements(ddl)) {\n                SqlRenderer.denyMultiStmtOrComment(stmt); // At this point each statement does not contain semicolon\n                coreSystemService.execDDL(stmt, UserInfoManagerHandler.getUserId(), SpaceInfoUtil.getSpaceId(), dbInfo.getDbId());\n            }\n        } catch (Exception ex) {\n            log.error(\"Failed to create table, params={}\", dbTableDto, ex);\n            throw new BusinessException(ResponseEnum.DATABASE_TABLE_CREATE_FAILED);\n        }\n\n    }\n\n\n    public List<DbTableVo> getDbTableList(Long dbId) {\n        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();","sourceCodeStart":320,"sourceCodeEnd":356,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/database/DatabaseService.java#L320-L356","documentation":"Generic failure thrown by DatabaseService.createDbTable when any step of table creation fails — this includes the DB metadata insert, field inserts, and especially the remote DDL execution via coreSystemService.execDDL. It is the outer catch (Exception) at line 336-338; it masks the original exception, so server logs ('Failed to create table') hold the root cause.","triggerScenarios":"Any exception inside createDbTable's try block: core system unreachable when executing DDL, SQL rejected by the renderer (denyMultiStmtOrComment), invalid field name/type producing bad DDL, duplicate table already existing in the physical database, or transaction rollback on the metadata insert.","commonSituations":"Core system service down or misconfigured (wrong execDDL endpoint); reserved SQL keywords used as column names; field types unsupported by the target database; network partition between console backend and core service.","solutions":["Check backend logs for 'Failed to create table, params=' to find the root cause","Verify the core system service is up and execDDL connectivity works","Ensure field names avoid SQL reserved keywords and use valid types","Confirm the physical table doesn't already exist in the target database","Retry creation after fixing the underlying issue"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// pre-checks before createDbTable\nif (dbInfoMapper.selectById(dto.getDbId()) == null) throw new IllegalStateException(\"db not exist\");\nif (dto.getFields() == null || dto.getFields().isEmpty()) throw new IllegalStateException(\"fields empty\");","typeGuard":null,"tryCatchPattern":"try {\n    databaseService.createDbTable(dto);\n} catch (BusinessException e) {\n    // server logs contain the real root cause under 'Failed to create table'\n    log.error(\"table creation failed for dbId={}\", dto.getDbId(), e);\n    throw e;\n}","preventionTips":["Check core system health/execDDL connectivity before bulk table creation","Avoid SQL reserved keywords and unsupported types in field definitions","Watch backend logs for the wrapped root cause — this error masks it","Ensure the physical table name is unique in the target database"],"tags":["database","ddl","create-failed","service-unavailable"],"backgroundTag":"database-write-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"}