iflytek/astron-agent · error · BusinessException

RPA_IS_USAGE

RPA_IS_USAGE

Error message

BusinessException(ResponseEnum.RPA_IS_USAGE)

What it means

checkRpaIsUsage throws BusinessException(RPA_IS_USAGE) when any node of the workflow being deleted still references the RPA assistant — the deletion guard prevents removing an RPA resource that is in use by workflow nodes.

Solutions

  1. Remove or re-point the workflow nodes that use this assistant, then retry delete.
  2. List referencing workflows first and confirm with the owner before deletion.
  3. If intentional, delete the nodes and workflow versions referencing the assistant.
  4. Catch RPA_IS_USAGE and return the list of referencing workflows to the user.

Example fix

// before
service.delete(assistantId); // node still uses it
// after
workflowService.removeAssistantFromNodes(assistantId);
service.delete(assistantId);
Defensive patterns

Strategy: try-catch

Validate before calling

List<WorkflowNode> nodes = workflowService.findNodesUsingAssistant(assistantId);
boolean safeToDelete = nodes.stream().filter(Objects::nonNull).noneMatch(n -> isRpaNodeUsingAssistant(n, assistantId));

Try / catch

try { service.delete(id); } catch (BusinessException e) { if (ResponseEnum.RPA_IS_USAGE.equals(e.getCode())) { showReferencingWorkflows(workflowService.findWorkflowsUsingAssistant(id)); } else { throw e; } }

Prevention

When it happens

Trigger: Calling delete(assistantId) while one or more workflow nodes still reference the assistant (matched via isRpaNodeUsingAssistant).

Common situations: Deleting an assistant that is wired into live workflows; bulk cleanup of unused-looking assistants that are actually referenced; stale local copy of workflows missing the reference.

Understand the failure class

Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.

Related errors


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

Appendix: source

Thrown at console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/tool/RpaAssistantService.java:417

            BizWorkflowData bizWorkflowData;
            try {
                bizWorkflowData = JSON.parseObject(dataJson, BizWorkflowData.class);
            } catch (Exception e) {
                log.warn("Invalid workflow data JSON, workflowId={}", workflow.getId(), e);
                continue;
            }

            List<BizWorkflowNode> nodes = bizWorkflowData.getNodes();
            if (CollUtil.isEmpty(nodes)) {
                continue;
            }

            boolean inUse = nodes.stream()
                    .filter(Objects::nonNull)
                    .anyMatch(node -> isRpaNodeUsingAssistant(node, assistantId));

            if (inUse) {
                throw new BusinessException(ResponseEnum.RPA_IS_USAGE);
            }
        }
    }

    /**
     * Check if a single node is an RPA node using the specified assistant.
     *
     * @param node workflow node
     * @param assistantId assistant ID
     * @return true if the node is an RPA node referencing the assistant
     */
    private boolean isRpaNodeUsingAssistant(BizWorkflowNode node, Long assistantId) {
        if (node == null || StringUtils.isBlank(node.getId()) || node.getData() == null) {
            return false;
        }

        String nodeId = node.getId();
        // Defensive: only split once and handle missing prefix

View on GitHub (pinned to 5e758547a8)