{"record":{"id":"00931f5bf4676f64","repo":"iflytek/astron-agent","slug":"workflow-not-public","errorCode":"WORKFLOW_NOT_PUBLIC","errorMessage":"ResponseEnum.WORKFLOW_NOT_PUBLIC","messagePattern":"ResponseEnum\\.WORKFLOW_NOT_PUBLIC","errorType":"error_code","errorClass":"BusinessException","httpStatus":null,"severity":"error","filePath":"console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/workflow/WorkflowService.java","lineNumber":3875,"sourceCode":"        });\n\n        return bizWorkflowData;\n    }\n\n    @Transactional(rollbackFor = Exception.class)\n    public Object publicCopy(WorkflowReq req) {\n        if (req.getId() == null) {\n            return ApiResult.error(ResponseEnum.BAD_REQUEST);\n        }\n        req.setAppId(commonConfig.getAppId());\n        String appId = req.getAppId();\n        // Validate workflow ID\n        Workflow prototype = getById(req.getId());\n        if (prototype == null) {\n            throw new BusinessException(ResponseEnum.WORKFLOW_NOT_EXIST);\n        }\n        if (!prototype.getIsPublic() && !Objects.equals(prototype.getUid(), bizConfig.getAdminUid())) {\n            throw new BusinessException(ResponseEnum.WORKFLOW_NOT_PUBLIC);\n        }\n\n        // Force set to unpublished\n        prototype.setStatus(WorkflowConst.Status.UNPUBLISHED);\n\n        // Call core system to get flow ID\n        WorkflowReq flowReq = new WorkflowReq();\n        BeanUtils.copyProperties(prototype, flowReq);\n        flowReq.setAppId(appId);\n        ApiResult<String> addResult = callProtocolAdd(flowReq);\n        if (addResult.code() != 0) {\n            return addResult;\n        }\n        String nFlowId = addResult.data();\n\n        // Update core system\n        BizWorkflowData bizWorkflowData = handleDataPublicCopy(nFlowId, appId, prototype.getData());\n","sourceCodeStart":3857,"sourceCodeEnd":3893,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/workflow/WorkflowService.java#L3857-L3893","documentation":"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.","triggerScenarios":"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.","commonSituations":"A teammate tries to publish someone else's private workflow; operating across accounts or spaces; misconfigured bizConfig admin uid so even admins get rejected.","solutions":["Ask the workflow owner to set the workflow public (isPublic=true) before others publish it.","Log in as the workflow owner or the configured admin account.","Verify bizConfig.getAdminUid() is configured correctly for the environment.","If access should be shared, transfer ownership or duplicate the workflow into the requester's space."],"exampleFix":"// before\nif (!prototype.getIsPublic() && !Objects.equals(prototype.getUid(), bizConfig.getAdminUid())) {\n    throw new BusinessException(ResponseEnum.WORKFLOW_NOT_PUBLIC);\n}\n// after\nboolean admin = Objects.equals(prototype.getUid(), bizConfig.getAdminUid());\nif (!prototype.getIsPublic() && !admin && !Objects.equals(prototype.getUid(), UserInfoManagerHandler.getUserId())) {\n    throw new BusinessException(ResponseEnum.WORKFLOW_NOT_PUBLIC);\n}","handlingStrategy":"type-guard","validationCode":"const canPublish = wf.isPublic || wf.uid === currentUser.uid || currentUser.uid === adminUid; if (!canPublish) alert('workflow is private');","typeGuard":"boolean canOperate(Workflow w, String uid) { return w != null && (Boolean.TRUE.equals(w.getIsPublic()) || uid.equals(w.getUid())); }","tryCatchPattern":"try { publish(req); } catch (BusinessException e) { if ('WORKFLOW_NOT_PUBLIC'.equals(e.getCode())) { promptRequestAccess(); } }","preventionTips":["Hide publish actions on private workflows you don't own","Verify bizConfig adminUid per environment","Check isPublic flag before deep-linking others to a workflow"],"tags":["java","authorization","workflow"],"backgroundTag":"insufficient-permissions","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"}