iflytek/astron-agent · error · BusinessException

DATA_NOT_EXIST

DATA_NOT_EXIST

Error message

DATA_NOT_EXIST

What it means

DATA_NOT_EXIST is thrown by requireApproval when no PublishApproval row matches the given approvalId for the requesting space, the row's spaceId differs, or it is soft-deleted (deleted=1). The error hides whether the record never existed or is inaccessible.

Solutions

  1. Refresh the approval list and use a current, valid approvalId
  2. Verify the approvalId belongs to the spaceId in the request
  3. Check the publish_approval table row: confirm id, space_id, and deleted=0
  4. Re-create the publish request if the original approval record was deleted

Example fix

// before
approvalService.approval(999L, spaceId); // already deleted
// after
PublishApproval a = publishApprovalMapper.selectById(999L);
if (a != null && Objects.equals(a.getSpaceId(), spaceId) && Objects.equals(a.getDeleted(), 0)) {
    approvalService.approval(999L, spaceId);
}
Defensive patterns

Strategy: validation

Validate before calling

PublishApproval a = publishApprovalMapper.selectById(id); boolean valid = a != null && Objects.equals(a.getSpaceId(), spaceId) && Objects.equals(a.getDeleted(), 0);

Try / catch

try { service.approval(id, spaceId); } catch (BusinessException e) { refreshApprovalList(); ui.show("Approval not found"); }

Prevention

When it happens

Trigger: approval() calls requireApproval with an approvalId that does not exist, belongs to another space, or was soft-deleted.

Common situations: Stale approval id from an old UI tab; user operates on an approval from a different space; record was cancelled/cleaned and soft-deleted; typo'd id from client.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


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

Appendix: source

Thrown at console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/publish/impl/PublishApprovalServiceImpl.java:328

        }
        if (workflow != null) {
            return workflow;
        }
        return workflowMapper.selectOne(new LambdaQueryWrapper<Workflow>()
                .eq(Workflow::getFlowId, resourceId));
    }

    private void assertReviewer(Long spaceId, String uid) {
        SpaceRoleEnum currentRole = spaceUserService.getRole(spaceId, uid);
        if (!isOwnerOrAdmin(currentRole)) {
            throw new BusinessException(ResponseEnum.INSUFFICIENT_PERMISSIONS);
        }
    }

    private PublishApproval requireApproval(Long approvalId, Long spaceId) {
        PublishApproval approval = publishApprovalMapper.selectById(approvalId);
        if (approval == null || !Objects.equals(approval.getSpaceId(), spaceId) || Objects.equals(approval.getDeleted(), 1)) {
            throw new BusinessException(ResponseEnum.DATA_NOT_EXIST);
        }
        return approval;
    }

    private PublishApproval requirePendingApproval(Long approvalId, Long spaceId) {
        PublishApproval approval = requireApproval(approvalId, spaceId);
        if (!Objects.equals(approval.getApprovalStatus(), PublishApprovalStatusEnum.PENDING.name())) {
            throw new BusinessException(ResponseEnum.OPERATION_FAILED);
        }
        return approval;
    }

    private PublishApprovalExecutor findExecutor(PublishApproval approval) {
        return publishApprovalExecutors.stream()
                .filter(executor -> executor.supports(approval))
                .findFirst()
                .orElseThrow(() -> new BusinessException(ResponseEnum.OPERATION_FAILED));
    }

View on GitHub (pinned to 5e758547a8)