{"record":{"id":"b1a674484c45a2a9","repo":"iflytek/astron-agent","slug":"data-not-exist-businessexception-responseenum","errorCode":"DATA_NOT_EXIST","errorMessage":"BusinessException(ResponseEnum.DATA_NOT_EXIST)","messagePattern":"BusinessException\\(ResponseEnum\\.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/skill/SkillSandboxConfigService.java","lineNumber":153,"sourceCode":"        assertExplicitScope(uid, spaceId);\n        SkillSandboxConfig config;\n        if (StringUtils.isNotBlank(flowId)) {\n            List<Workflow> workflows = workflowMapper.selectList(\n                    Wrappers.lambdaQuery(Workflow.class)\n                            .eq(Workflow::getFlowId, StringUtils.trim(flowId))\n                            .eq(Workflow::getDeleted, Boolean.FALSE)\n                            .last(\"limit 2\"));\n            if (workflows == null || workflows.size() != 1) {\n                throw new BusinessException(ResponseEnum.WORKFLOW_NOT_EXIST);\n            }\n            Workflow workflow = workflows.getFirst();\n            assertWorkflowExecutionScope(workflow, uid, spaceId);\n            config = getActiveConfigForTrustedScope(workflow.getUid(), workflow.getSpaceId());\n        } else {\n            config = getActiveConfigForTrustedScope(uid, spaceId);\n        }\n        if (config == null) {\n            throw new BusinessException(ResponseEnum.DATA_NOT_EXIST);\n        }\n        return new SkillSandboxRuntimeCredentialDto(\n                normalizeProvider(config.getProvider()),\n                config.getApiKey(),\n                normalizeTimeout(config.getTimeoutSeconds()),\n                Boolean.TRUE.equals(config.getAllowInternetAccess()));\n    }\n\n    private void assertWorkflowExecutionScope(Workflow workflow, String uid, Long spaceId) {\n        if (workflow.getSpaceId() == null) {\n            if (spaceId != null || !StringUtils.equals(workflow.getUid(), uid)) {\n                throw new BusinessException(ResponseEnum.INSUFFICIENT_PERMISSIONS);\n            }\n            return;\n        }\n        if (!java.util.Objects.equals(workflow.getSpaceId(), spaceId)) {\n            throw new BusinessException(ResponseEnum.INSUFFICIENT_PERMISSIONS);\n        }","sourceCodeStart":135,"sourceCodeEnd":171,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/skill/SkillSandboxConfigService.java#L135-L171","documentation":"After resolving the correct scope (from workflow or explicit uid/space), getRuntimeCredential loads the active sandbox config; if none exists it throws DATA_NOT_EXIST. The workflow exists but no enabled SkillSandboxConfig with an API key is registered for its scope.","triggerScenarios":"Requesting runtime credentials for a workflow/uid+space that has no sandbox config row, or one that is disabled or has a blank apiKey (getActiveConfigForTrustedScope returns null for those).","commonSituations":"Sandbox runtime provisioned before any sandbox config was created; config disabled during a key rotation and never re-enabled; apiKey field cleared in the config; querying the wrong space.","solutions":["Create or restore the sandbox config for the workflow's uid/space via the sandbox config API.","Check that the config row is enabled=true and has a non-blank api_key.","Confirm you are querying the same spaceId/uid the config was created under.","If using the flowId path, note the scope comes from the workflow itself; verify the workflow's space."],"exampleFix":"// before\nclient.getCredential(token, flowId); // no config exists\n// after\nsandboxConfigClient.upsert(uid, spaceId, provider, apiKey, timeout, allowInternet, enabled=true);\nclient.getCredential(token, flowId);","handlingStrategy":"validation","validationCode":"SandboxConfigDto cfg = sandboxConfigClient.get(uid, spaceId);\nif (cfg == null || !cfg.isEnabled() || cfg.getApiKey() == null || cfg.getApiKey().isBlank()) {\n    throw new IllegalArgumentException(\"No enabled sandbox config with API key for this scope\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    cred = getRuntimeCredential(token, flowId, uid, spaceId);\n} catch (BusinessException e) {\n    if (\"DATA_NOT_EXIST\".equals(e.getCode())) provisionSandboxConfigFirst();\n}","preventionTips":["Provision the sandbox config as part of workflow/space onboarding.","Alert on configs left disabled or with blank api_key.","Keep config scope (uid/space) and workflow scope in sync."],"tags":["java","config","not-found","database"],"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"}