iflytek/astron-agent · warning · BusinessException
DATABASE_DELETE_FAILED_CITED
DATABASE_DELETE_FAILED_CITED
Error message
DATABASE_DELETE_FAILED_CITED
What it means
Thrown by DatabaseService.delete when the database is still referenced by one or more workflow relations: flowDbRelMapper.selectCount on dbId returns > 0. Deletion is blocked to avoid breaking flows that depend on the database. Note this BusinessException is again caught by the same method's outer catch and re-wrapped (see that method's generic failure error).
Solutions
- Unbind/remove the workflows referencing this database, then retry delete
- Query flow_db_rel by dbId to find which flows block deletion
- If relations are stale (flows already deleted), clean up orphan flow_db_rel rows
- Choose a different database for new flows and retire this one gradually
Example fix
// before
databaseService.delete(dbId); // throws if cited by flows
// after
long refs = flowDbRelMapper.selectCount(new QueryWrapper<FlowDbRel>().eq(FlowDbRel::getDbId, dbId));
if (refs == 0) { databaseService.delete(dbId); } Defensive patterns
Strategy: validation
Validate before calling
long refs = flowDbRelMapper.selectCount(new QueryWrapper<FlowDbRel>().lambda().eq(FlowDbRel::getDbId, dbId));
if (refs > 0) { /* block delete or unbind flows first */ } Try / catch
try { databaseService.delete(id); } catch (BusinessException e) { if ("DATABASE_DELETE_FAILED_CITED".equals(e.getCode())) { /* list dependent flows and ask user to unbind */ } else { throw e; } } Prevention
- Check flow_db_rel references before offering delete in the UI
- Clean up flow_db_rel rows when flows are deleted
- Communicate dependencies to users before hard deletes
When it happens
Trigger: Calling delete(id) while at least one row in flow_db_rel references dbInfo.getDbId().
Common situations: Trying to remove a database that is wired into an active workflow; leftover flow_db_rel rows from deleted flows that were not cleaned up; shared dev databases still bound to test flows.
Related errors
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/87f683b82773ffef.
Report an issue: GitHub.
Appendix: source
Thrown at console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/database/DatabaseService.java:175
}
dbInfo.setDescription(databaseDto.getDescription());
}
dbInfoMapper.updateById(dbInfo);
} catch (Exception ex) {
log.error("Failed to update database, params={}", JSONObject.toJSONString(databaseDto), ex);
throw new BusinessException(ResponseEnum.DATABASE_UPDATE_FAILED);
}
}
public void delete(Long id) {
try {
// Check if the database is being referenced
dataPermissionCheckTool.checkDbUpdateBelong(id);
DbInfo dbInfo = dbInfoMapper.selectById(id);
Long count = flowDbRelMapper.selectCount(new QueryWrapper<FlowDbRel>().lambda()
.eq(FlowDbRel::getDbId, dbInfo.getDbId()));
if (count > 0) {
throw new BusinessException(ResponseEnum.DATABASE_DELETE_FAILED_CITED);
}
// Delete from core system
coreSystemService.dropDataBase(dbInfo.getDbId(), UserInfoManagerHandler.getUserId());
dbInfo.setDeleted(true);
dbInfoMapper.updateById(dbInfo);
} catch (Exception ex) {
log.error("Failed to delete database, dbId={}", id, ex);
throw ex;
}
}
@Transactional
public void copyDatabase(Long id) {
try {
DbInfo dbInfo = dbInfoMapper.selectById(id);
DbInfo newDbInfo = new DbInfo();
newDbInfo.setName(dbInfo.getName() + "_副本");
newDbInfo.setDescription(dbInfo.getDescription());View on GitHub (pinned to 5e758547a8)