{"record":{"id":"30a7e787b8a085da","repo":"iflytek/astron-agent","slug":"data-not-exist-30a7e7","errorCode":"DATA_NOT_EXIST","errorMessage":"DATA_NOT_EXIST","messagePattern":"DATA_NOT_EXIST","errorType":"error_code","errorClass":"BusinessException","httpStatus":null,"severity":"error","filePath":"console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/workflow/WorkflowArtifactService.java","lineNumber":373,"sourceCode":"                        \"Failed to compensate workflow artifact upload, bucket={}, objectKey={}\",\n                        artifactProperties.getArtifactBucket(),\n                        objectKey);\n            }\n            throw exception;\n        }\n    }\n\n    private WorkflowArtifact getScopedArtifact(Long artifactId) {\n        if (artifactId == null) {\n            throw new BusinessException(ResponseEnum.PARAM_ERROR);\n        }\n        LambdaQueryWrapper<WorkflowArtifact> wrapper = Wrappers.lambdaQuery(WorkflowArtifact.class)\n                .eq(WorkflowArtifact::getId, artifactId)\n                .eq(WorkflowArtifact::getDeleted, Boolean.FALSE);\n        applyCurrentArtifactScope(wrapper);\n        WorkflowArtifact artifact = getOne(wrapper, false);\n        if (artifact == null) {\n            throw new BusinessException(ResponseEnum.DATA_NOT_EXIST);\n        }\n        return artifact;\n    }\n\n    private LambdaQueryWrapper<WorkflowArtifact> scopeQuery(Long workflowId) {\n        LambdaQueryWrapper<WorkflowArtifact> wrapper = Wrappers.lambdaQuery(WorkflowArtifact.class)\n                .eq(WorkflowArtifact::getWorkflowId, workflowId)\n                .eq(WorkflowArtifact::getDeleted, Boolean.FALSE);\n        applyCurrentArtifactScope(wrapper);\n        return wrapper;\n    }\n\n    private void applyCurrentArtifactScope(LambdaQueryWrapper<WorkflowArtifact> wrapper) {\n        String currentUid = UserInfoManagerHandler.getUserId();\n        Long spaceId = SpaceInfoUtil.getSpaceId();\n        if (StringUtils.isBlank(currentUid)) {\n            throw new BusinessException(ResponseEnum.UNAUTHORIZED);\n        }","sourceCodeStart":355,"sourceCodeEnd":391,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/workflow/WorkflowArtifactService.java#L355-L391","documentation":"getScopedArtifact throws DATA_NOT_EXIST when no WorkflowArtifact row matches the given ID under the current scope (deleted=FALSE plus the current space/uid filter). The artifact either never existed, was soft-deleted, or belongs to another space/user, but the error deliberately does not distinguish these cases to avoid leaking existence information.","triggerScenarios":"Requesting an artifact ID that was already deleted (deleteArtifact sets deleted=TRUE); using an ID from a different space or user; stale ID cached in the frontend after deletion; querying before the upload transaction commits.","commonSituations":"UI keeping a stale artifact reference after a delete; copying an artifact ID/URL from another environment or space; race between delete and a concurrent download.","solutions":["Refresh the artifact list and use a current, valid artifact ID","Verify you are operating in the correct space and account that owns the artifact","If the artifact should exist, query the DB directly (including deleted rows) to check whether it was soft-deleted","Remove or invalidate cached artifact references in the client after deletion"],"exampleFix":"// before: stale reference after delete\nawait deleteArtifact(id);\nawait downloadArtifact(id); // DATA_NOT_EXIST\n// after\nawait deleteArtifact(id);\nconst list = await listArtifacts(workflowId);\nconst next = list.find(a => a.id !== id);\nif (next) await downloadArtifact(next.id);","handlingStrategy":"fallback","validationCode":"// Check existence in a list call before a direct fetch\nboolean exists = artifactApi.listArtifacts(workflowId).stream()\n        .anyMatch(a -> a.getId().equals(artifactId));","typeGuard":null,"tryCatchPattern":"try {\n    return artifactApi.get(artifactId);\n} catch (BusinessException e) {\n    if (\"DATA_NOT_EXIST\".equals(e.getCode())) {\n        log.info(\"Artifact {} not found under current scope; refreshing list\", artifactId);\n        return Optional.empty(); // treat as absent, refresh client state\n    }\n    throw e;\n}","preventionTips":["Invalidate cached artifact references after delete operations","Always operate within the space that owns the artifact","Handle stale-ID races by refreshing the list rather than retrying the direct fetch"],"tags":["java","not-found","soft-delete","api","workflow-artifact"],"backgroundTag":"entity-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"}