iflytek/astron-agent · error · BusinessException

DATA_NOT_EXIST

DATA_NOT_EXIST

Error message

BusinessException(ResponseEnum.DATA_NOT_EXIST)

What it means

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.

Solutions

  1. Create or restore the sandbox config for the workflow's uid/space via the sandbox config API.
  2. Check that the config row is enabled=true and has a non-blank api_key.
  3. Confirm you are querying the same spaceId/uid the config was created under.
  4. If using the flowId path, note the scope comes from the workflow itself; verify the workflow's space.

Example fix

// before
client.getCredential(token, flowId); // no config exists
// after
sandboxConfigClient.upsert(uid, spaceId, provider, apiKey, timeout, allowInternet, enabled=true);
client.getCredential(token, flowId);
Defensive patterns

Strategy: validation

Validate before calling

SandboxConfigDto cfg = sandboxConfigClient.get(uid, spaceId);
if (cfg == null || !cfg.isEnabled() || cfg.getApiKey() == null || cfg.getApiKey().isBlank()) {
    throw new IllegalArgumentException("No enabled sandbox config with API key for this scope");
}

Try / catch

try {
    cred = getRuntimeCredential(token, flowId, uid, spaceId);
} catch (BusinessException e) {
    if ("DATA_NOT_EXIST".equals(e.getCode())) provisionSandboxConfigFirst();
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

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/b1a674484c45a2a9. Report an issue: GitHub.

Appendix: source

Thrown at console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/skill/SkillSandboxConfigService.java:153

        assertExplicitScope(uid, spaceId);
        SkillSandboxConfig config;
        if (StringUtils.isNotBlank(flowId)) {
            List<Workflow> workflows = workflowMapper.selectList(
                    Wrappers.lambdaQuery(Workflow.class)
                            .eq(Workflow::getFlowId, StringUtils.trim(flowId))
                            .eq(Workflow::getDeleted, Boolean.FALSE)
                            .last("limit 2"));
            if (workflows == null || workflows.size() != 1) {
                throw new BusinessException(ResponseEnum.WORKFLOW_NOT_EXIST);
            }
            Workflow workflow = workflows.getFirst();
            assertWorkflowExecutionScope(workflow, uid, spaceId);
            config = getActiveConfigForTrustedScope(workflow.getUid(), workflow.getSpaceId());
        } else {
            config = getActiveConfigForTrustedScope(uid, spaceId);
        }
        if (config == null) {
            throw new BusinessException(ResponseEnum.DATA_NOT_EXIST);
        }
        return new SkillSandboxRuntimeCredentialDto(
                normalizeProvider(config.getProvider()),
                config.getApiKey(),
                normalizeTimeout(config.getTimeoutSeconds()),
                Boolean.TRUE.equals(config.getAllowInternetAccess()));
    }

    private void assertWorkflowExecutionScope(Workflow workflow, String uid, Long spaceId) {
        if (workflow.getSpaceId() == null) {
            if (spaceId != null || !StringUtils.equals(workflow.getUid(), uid)) {
                throw new BusinessException(ResponseEnum.INSUFFICIENT_PERMISSIONS);
            }
            return;
        }
        if (!java.util.Objects.equals(workflow.getSpaceId(), spaceId)) {
            throw new BusinessException(ResponseEnum.INSUFFICIENT_PERMISSIONS);
        }

View on GitHub (pinned to 5e758547a8)