iflytek/astron-agent · error · BusinessException

DATABASE_UPDATE_FAILED

DATABASE_UPDATE_FAILED

Error message

DATABASE_UPDATE_FAILED

What it means

Generic catch-all in DatabaseService.updateDateBase: any exception while loading the DbInfo, applying field changes, or calling dbInfoMapper.updateById is converted to DATABASE_UPDATE_FAILED. It hides the underlying cause (record missing, permission check failure, SQL error), so the log 'Failed to update database' must be consulted.

Solutions

  1. Read the logged stack trace for the true cause
  2. Confirm the database id exists and is not soft-deleted before updating
  3. Retry the update if it was a transient lock/connection error
  4. Check the permission-check tool is not rejecting the current user/space
Defensive patterns

Strategy: try-catch

Validate before calling

DbInfo db = dbInfoMapper.selectById(id);
if (db == null || Boolean.TRUE.equals(db.getDeleted())) { throw new IllegalStateException("db not found: " + id); }

Try / catch

try { databaseService.updateDateBase(dto); } catch (BusinessException e) { if ("DATABASE_UPDATE_FAILED".equals(e.getCode())) { /* verify id exists, check logs, retry once */ } else { throw e; } }

Prevention

When it happens

Trigger: Updating a database whose id does not exist; data-permission check throws; dbInfoMapper.updateById fails (lock timeout, connection error); NPE while reading fields of a null dbInfo.

Common situations: Two users editing the same database concurrently with optimistic/pessimistic lock conflicts; stale UI sending an id that was already deleted; DB connectivity blips.

Related errors


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

Appendix: source

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

        }
    }

    @Transactional
    public void updateDateBase(DatabaseDto databaseDto) {
        try {
            dataPermissionCheckTool.checkDbUpdateBelong(databaseDto.getId());
            // Name validation
            DbInfo dbInfo = dbInfoMapper.selectById(databaseDto.getId());
            if (StringUtils.isNotBlank(databaseDto.getDescription())) {
                if (!databaseDto.getDescription().equals(dbInfo.getDescription())) {
                    coreSystemService.modifyDataBase(dbInfo.getDbId(), UserInfoManagerHandler.getUserId(), databaseDto.getDescription());
                }
                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) {

View on GitHub (pinned to 5e758547a8)