iflytek/astron-agent · error · BusinessException

DATABASE_COPY_FAILED

DATABASE_COPY_FAILED

Error message

DATABASE_COPY_FAILED

What it means

Catch-all in DatabaseService.copyDatabase: any failure while loading the source database, generating the copy name, calling coreSystemService.cloneDataBase, or persisting the new record is converted to DATABASE_COPY_FAILED. The log 'copy database failed,dbId=' contains the underlying stack trace.

Solutions

  1. Check the logged stack trace for the root cause
  2. Verify the source dbId still exists and the user has access
  3. Retry the copy if the core-system call failed transiently
  4. Ensure the target name (copy name) is unique in the space
Defensive patterns

Strategy: retry

Validate before calling

DbInfo src = dbInfoMapper.selectById(id);
if (src == null || Boolean.TRUE.equals(src.getDeleted())) { throw new IllegalStateException("source db missing"); }

Try / catch

try { databaseService.copyDatabase(id); } catch (BusinessException e) { if ("DATABASE_COPY_FAILED".equals(e.getCode())) { /* check core-system health, retry with backoff */ } else { throw e; } }

Prevention

When it happens

Trigger: Source id does not exist or user lacks permission; coreSystemService.cloneDataBase RPC fails or times out; dbInfoMapper.updateById fails after clone; duplicate resulting name violates uniqueness downstream.

Common situations: Core service degraded/unreachable during clone; cloning a database concurrently from two tabs; source database was deleted between listing and copying.

Understand the failure class

Background: "API request failed": what wrapped HTTP errors from external APIs mean and how to find the real cause — this error's family across 29 libraries.

Related errors


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

Appendix: source

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

                        dbTableFieldMapper.selectList(new QueryWrapper<DbTableField>().lambda()
                                .eq(DbTableField::getTbId, dbTable.getId())).forEach(dbTableField -> {
                                    DbTableField newDbTableField = new DbTableField();
                                    BeanUtils.copyProperties(dbTableField, newDbTableField);
                                    newDbTableField.setTbId(newDbTable.getId());
                                    newDbTableField.setId(null);
                                    newDbTableField.setCreateTime(new Date());
                                    newDbTableField.setUpdateTime(new Date());
                                    fields.add(newDbTableField);
                                });
                        dbTableFieldMapper.insertBatch(fields);
                    });
            // Call core system to create database
            Long dbId = coreSystemService.cloneDataBase(dbInfo.getDbId(), newDbInfo.getName(), UserInfoManagerHandler.getUserId());
            newDbInfo.setDbId(dbId);
            dbInfoMapper.updateById(newDbInfo);
        } catch (Exception ex) {
            log.error("copy database failed,dbId={}", id, ex);
            throw new BusinessException(ResponseEnum.DATABASE_COPY_FAILED);
        }

    }


    public void addFlowRel(String dbId, String tbName, String flowId) {
        DbTable dbTable = dbTableMapper.selectByDbId(dbId, tbName);
        FlowDbRel flowDbRel = new FlowDbRel();
        flowDbRel.setFlowId(flowId);
        flowDbRel.setDbId(dbId);
        flowDbRel.setTbId(dbTable.getId());
        flowDbRel.setCreateTime(new Date());
        flowDbRelMapper.insert(flowDbRel);
    }

    public Page<DbInfo> selectPage(DataBaseSearchVo databaseDto) {
        try {
            Long spaceId = SpaceInfoUtil.getSpaceId();

View on GitHub (pinned to 5e758547a8)