iflytek/astron-agent · error · BusinessException

DATABASE_TABLE_CREATE_FAILED

DATABASE_TABLE_CREATE_FAILED

Error message

DATABASE_TABLE_CREATE_FAILED

What it means

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.

Solutions

  1. Check backend logs for 'Failed to create table, params=' to find the root cause
  2. Verify the core system service is up and execDDL connectivity works
  3. Ensure field names avoid SQL reserved keywords and use valid types
  4. Confirm the physical table doesn't already exist in the target database
  5. Retry creation after fixing the underlying issue
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-checks before createDbTable
if (dbInfoMapper.selectById(dto.getDbId()) == null) throw new IllegalStateException("db not exist");
if (dto.getFields() == null || dto.getFields().isEmpty()) throw new IllegalStateException("fields empty");

Try / catch

try {
    databaseService.createDbTable(dto);
} catch (BusinessException e) {
    // server logs contain the real root cause under 'Failed to create table'
    log.error("table creation failed for dbId={}", dto.getDbId(), e);
    throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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

Appendix: source

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

                    }
                    dbTableField.setIsSystem(false);
                }
                dbTableField.setTbId(dbTable.getId());
                dbTableField.setCreateTime(new Date());
                dbTableField.setUpdateTime(new Date());
                fields.add(dbTableField);
            }
            dbTableFieldMapper.insertBatch(fields);
            // Save to core system
            String ddl = buildDDL(dbTableDto, DBOperateEnum.INSERT.getCode(), null);
            // Call core system to create table
            for (String stmt : safeSplitStatements(ddl)) {
                SqlRenderer.denyMultiStmtOrComment(stmt); // At this point each statement does not contain semicolon
                coreSystemService.execDDL(stmt, UserInfoManagerHandler.getUserId(), SpaceInfoUtil.getSpaceId(), dbInfo.getDbId());
            }
        } catch (Exception ex) {
            log.error("Failed to create table, params={}", dbTableDto, ex);
            throw new BusinessException(ResponseEnum.DATABASE_TABLE_CREATE_FAILED);
        }

    }


    public List<DbTableVo> getDbTableList(Long dbId) {
        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();

View on GitHub (pinned to 5e758547a8)