iflytek/astron-agent · error · BusinessException

WORKFLOW_NOT_PUBLIC

WORKFLOW_NOT_PUBLIC

Error message

ResponseEnum.WORKFLOW_NOT_PUBLIC

What it means

After confirming the workflow exists, the service checks visibility: if the workflow is not public and the current user is not its owner/admin (bizConfig.getAdminUid()), it throws BusinessException(WORKFLOW_NOT_PUBLIC). It is an authorization error for private workflows.

Solutions

  1. Ask the workflow owner to set the workflow public (isPublic=true) before others publish it.
  2. Log in as the workflow owner or the configured admin account.
  3. Verify bizConfig.getAdminUid() is configured correctly for the environment.
  4. If access should be shared, transfer ownership or duplicate the workflow into the requester's space.

Example fix

// before
if (!prototype.getIsPublic() && !Objects.equals(prototype.getUid(), bizConfig.getAdminUid())) {
    throw new BusinessException(ResponseEnum.WORKFLOW_NOT_PUBLIC);
}
// after
boolean admin = Objects.equals(prototype.getUid(), bizConfig.getAdminUid());
if (!prototype.getIsPublic() && !admin && !Objects.equals(prototype.getUid(), UserInfoManagerHandler.getUserId())) {
    throw new BusinessException(ResponseEnum.WORKFLOW_NOT_PUBLIC);
}
Defensive patterns

Strategy: type-guard

Validate before calling

const canPublish = wf.isPublic || wf.uid === currentUser.uid || currentUser.uid === adminUid; if (!canPublish) alert('workflow is private');

Type guard

boolean canOperate(Workflow w, String uid) { return w != null && (Boolean.TRUE.equals(w.getIsPublic()) || uid.equals(w.getUid())); }

Try / catch

try { publish(req); } catch (BusinessException e) { if ('WORKFLOW_NOT_PUBLIC'.equals(e.getCode())) { promptRequestAccess(); } }

Prevention

When it happens

Trigger: Calling the workflow publish API on a workflow whose isPublic=false while the current user's uid differs from the workflow owner and the configured admin uid.

Common situations: A teammate tries to publish someone else's private workflow; operating across accounts or spaces; misconfigured bizConfig admin uid so even admins get rejected.

Understand the failure class

Background: "You do not have permission" / 403 Forbidden errors: authenticated but not allowed — causes and fixes across open-source libraries — 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/00931f5bf4676f64. Report an issue: GitHub.

Appendix: source

Thrown at console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/workflow/WorkflowService.java:3875

        });

        return bizWorkflowData;
    }

    @Transactional(rollbackFor = Exception.class)
    public Object publicCopy(WorkflowReq req) {
        if (req.getId() == null) {
            return ApiResult.error(ResponseEnum.BAD_REQUEST);
        }
        req.setAppId(commonConfig.getAppId());
        String appId = req.getAppId();
        // Validate workflow ID
        Workflow prototype = getById(req.getId());
        if (prototype == null) {
            throw new BusinessException(ResponseEnum.WORKFLOW_NOT_EXIST);
        }
        if (!prototype.getIsPublic() && !Objects.equals(prototype.getUid(), bizConfig.getAdminUid())) {
            throw new BusinessException(ResponseEnum.WORKFLOW_NOT_PUBLIC);
        }

        // Force set to unpublished
        prototype.setStatus(WorkflowConst.Status.UNPUBLISHED);

        // Call core system to get flow ID
        WorkflowReq flowReq = new WorkflowReq();
        BeanUtils.copyProperties(prototype, flowReq);
        flowReq.setAppId(appId);
        ApiResult<String> addResult = callProtocolAdd(flowReq);
        if (addResult.code() != 0) {
            return addResult;
        }
        String nFlowId = addResult.data();

        // Update core system
        BizWorkflowData bizWorkflowData = handleDataPublicCopy(nFlowId, appId, prototype.getData());

View on GitHub (pinned to 5e758547a8)