{"record":{"id":"1c063285f2853d8a","repo":"iflytek/astron-agent","slug":"data-not-exist","errorCode":"DATA_NOT_EXIST","errorMessage":"DATA_NOT_EXIST","messagePattern":"DATA_NOT_EXIST","errorType":"error_code","errorClass":"BusinessException","httpStatus":null,"severity":"error","filePath":"console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/publish/impl/PublishApprovalServiceImpl.java","lineNumber":328,"sourceCode":"        }\n        if (workflow != null) {\n            return workflow;\n        }\n        return workflowMapper.selectOne(new LambdaQueryWrapper<Workflow>()\n                .eq(Workflow::getFlowId, resourceId));\n    }\n\n    private void assertReviewer(Long spaceId, String uid) {\n        SpaceRoleEnum currentRole = spaceUserService.getRole(spaceId, uid);\n        if (!isOwnerOrAdmin(currentRole)) {\n            throw new BusinessException(ResponseEnum.INSUFFICIENT_PERMISSIONS);\n        }\n    }\n\n    private PublishApproval requireApproval(Long approvalId, Long spaceId) {\n        PublishApproval approval = publishApprovalMapper.selectById(approvalId);\n        if (approval == null || !Objects.equals(approval.getSpaceId(), spaceId) || Objects.equals(approval.getDeleted(), 1)) {\n            throw new BusinessException(ResponseEnum.DATA_NOT_EXIST);\n        }\n        return approval;\n    }\n\n    private PublishApproval requirePendingApproval(Long approvalId, Long spaceId) {\n        PublishApproval approval = requireApproval(approvalId, spaceId);\n        if (!Objects.equals(approval.getApprovalStatus(), PublishApprovalStatusEnum.PENDING.name())) {\n            throw new BusinessException(ResponseEnum.OPERATION_FAILED);\n        }\n        return approval;\n    }\n\n    private PublishApprovalExecutor findExecutor(PublishApproval approval) {\n        return publishApprovalExecutors.stream()\n                .filter(executor -> executor.supports(approval))\n                .findFirst()\n                .orElseThrow(() -> new BusinessException(ResponseEnum.OPERATION_FAILED));\n    }","sourceCodeStart":310,"sourceCodeEnd":346,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/hub/src/main/java/com/iflytek/astron/console/hub/service/publish/impl/PublishApprovalServiceImpl.java#L310-L346","documentation":"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.","triggerScenarios":"approval() calls requireApproval with an approvalId that does not exist, belongs to another space, or was soft-deleted.","commonSituations":"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.","solutions":["Refresh the approval list and use a current, valid approvalId","Verify the approvalId belongs to the spaceId in the request","Check the publish_approval table row: confirm id, space_id, and deleted=0","Re-create the publish request if the original approval record was deleted"],"exampleFix":"// before\napprovalService.approval(999L, spaceId); // already deleted\n// after\nPublishApproval a = publishApprovalMapper.selectById(999L);\nif (a != null && Objects.equals(a.getSpaceId(), spaceId) && Objects.equals(a.getDeleted(), 0)) {\n    approvalService.approval(999L, spaceId);\n}","handlingStrategy":"validation","validationCode":"PublishApproval a = publishApprovalMapper.selectById(id); boolean valid = a != null && Objects.equals(a.getSpaceId(), spaceId) && Objects.equals(a.getDeleted(), 0);","typeGuard":null,"tryCatchPattern":"try { service.approval(id, spaceId); } catch (BusinessException e) { refreshApprovalList(); ui.show(\"Approval not found\"); }","preventionTips":["Refresh approval lists after mutations so ids stay current","Scope queries by spaceId so users only see their space's approvals","Never hard-delete; rely on soft-delete flags and filter them in queries"],"tags":["not-found","data-consistency","java"],"backgroundTag":"record-not-found","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}