iflytek/astron-agent · error · BusinessException
8514
8514
Error message
database.table.delete.failed.cited
What it means
Thrown by DatabaseService.deleteTable when the table is still referenced by at least one workflow (flow). The service counts rows in flow_db_rel for the tbId (line 646-649) and refuses to delete a cited table to avoid breaking workflows that depend on it.
Solutions
- Find and update/remove the workflows referencing the table (flow_db_rel rows for this tbId)
- Delete or rewire the dependent workflow nodes before retrying deletion
- If references are stale, clean the flow_db_rel entries for this tbId, then retry
- Only delete the table once selectCount on FlowDbRel.tbId returns 0
Example fix
// before deleteTable(tbId) // fails: 3 workflows cite this table // after // first remove the table from all workflow nodes, then: deleteTable(tbId)
Defensive patterns
Strategy: try-catch
Validate before calling
long citations = flowDbRelMapper.selectCount(
new QueryWrapper<FlowDbRel>().lambda().eq(FlowDbRel::getTbId, tbId));
if (citations > 0) {
throw new IllegalStateException("table is cited by " + citations + " workflow(s); detach first");
} Try / catch
try {
databaseService.deleteTable(tbId);
} catch (BusinessException e) {
if ("DATABASE_TABLE_DELETE_FAILED_CITED".equals(e.getCode())) {
// list workflows referencing this table and inform the user
}
throw e;
} Prevention
- Before deleting, query flow_db_rel for references to the tbId
- Provide UI to show which workflows cite a table
- Clean up stale workflow references when workflows are removed
- Establish a decommission process: detach from workflows, then delete
When it happens
Trigger: Calling deleteTable(tbId) where flowDbRelMapper.selectCount for that tbId > 0, i.e. one or more workflows reference the table in their configuration.
Common situations: Attempting to clean up database tables while old workflows still use them; soft-deleted or draft workflows still holding references in flow_db_rel; team unaware that a shared table is wired into production workflows.
Related errors
- DATABASE_DELETE_FAILED_CITED
- REPO_DELETE_FAILED_BOT_USED
- CREATE_BOT_FAILED
- UPDATE_BOT_FAILED
- NOTIFICATION_MARK_READ_FAILED
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/884f7d807f7df996.
Report an issue: GitHub.
Appendix: source
Thrown at console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/database/DatabaseService.java:643
} catch (Exception e) {
return 0;
}
case CommonConst.DBFieldType.BOOLEAN:
return Boolean.parseBoolean(v);
default:
return v; // Others as string
}
}
public void deleteTable(Long tbId) {
try {
DbTable dbTable = dbTableMapper.selectById(tbId);
dataPermissionCheckTool.checkDbBelong(dbTable.getDbId());
Long count = flowDbRelMapper.selectCount(new QueryWrapper<FlowDbRel>().lambda()
.eq(FlowDbRel::getTbId, tbId));
if (count > 0) {
throw new BusinessException(ResponseEnum.DATABASE_TABLE_DELETE_FAILED_CITED);
}
DbInfo dbInfo = dbInfoMapper.selectById(dbTable.getDbId());
DbTableDto dbTableDto = new DbTableDto();
dbTableDto.setName(dbTable.getName());
String ddl = buildDDL(dbTableDto, DBOperateEnum.DELETE.getCode(), null);
// Delete from core system
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());
}
dbTableMapper.update(new UpdateWrapper<DbTable>().lambda()
.eq(DbTable::getId, tbId)
.set(DbTable::getDeleted, true));
// Delete table fields
dbTableFieldMapper.delete(new UpdateWrapper<DbTableField>().lambda()
.eq(DbTableField::getTbId, tbId));
} catch (BusinessException ex) {
log.error("Failed to delete table, tbId={}", tbId);View on GitHub (pinned to 5e758547a8)