iflytek/astron-agent · error · BusinessException

WORKFLOW_NOT_EXIST

WORKFLOW_NOT_EXIST

Error message

WORKFLOW_NOT_EXIST

What it means

WorkflowService's detail/get lookup resolves a workflow either by flowId (string length >= 19, snowflake-like IDs) or by numeric primary key. If neither resolution finds a row, it throws BusinessException(ResponseEnum.WORKFLOW_NOT_EXIST); afterwards a data-permission visibility check runs for non-spec callers.

Solutions

  1. Verify the id passed matches an existing workflow (query the workflow table by flowId and by id)
  2. Confirm the user has the workflow in the current space (visibility check follows the existence check)
  3. Check whether the workflow was deleted (soft delete) and restore or use the correct id
  4. Guard callers: only call with ids obtained from list/detail APIs, and validate numeric-ness for short ids

Example fix

// before
String id = pathVariable; // could be flowId or db id
Workflow wf = workflowService.getWorkflowDetail(id, spaceId, false);
// after
if (id == null || id.isBlank()) throw new IllegalArgumentException("workflow id required");
Workflow wf = workflowService.getWorkflowDetail(id, spaceId, false); // throws WORKFLOW_NOT_EXIST if absent
Defensive patterns

Strategy: validation

Validate before calling

boolean numeric = id != null && id.chars().allMatch(Character::isDigit);
if (id == null || id.isBlank() || (numeric && id.length() < 19 && !existsById(Long.parseLong(id)))) {
    throw new BusinessException(ResponseEnum.WORKFLOW_NOT_EXIST);
}

Type guard

boolean isFlowId(String id) { return id != null && id.length() >= 19; }

Try / catch

try {
    WorkflowDetailVO vo = workflowService.getWorkflowDetail(id, spaceId, false);
} catch (BusinessException e) {
    if (ResponseEnum.WORKFLOW_NOT_EXIST.equals(e.getResponseEnum())) {
        // refresh list / notify user the workflow was deleted or is in another space
    }
}

Prevention

When it happens

Trigger: Calling workflow detail/get with an id that matches no workflow: wrong flowId, numeric id not present (deleted or other space), or an id string whose parse/lookup path mismatches how it was stored (e.g. passing a short numeric id to a flowId field or vice versa). Also Long.parseLong(id) on a non-numeric short id would throw NumberFormatException before this point.

Common situations: Client cached a workflow that was deleted; cross-space access where the workflow exists in another space; truncated or malformed id from URL routing; passing flowId vs database id interchangeably between frontend and backend.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


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

Appendix: source

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

     */
    public WorkflowVo detail(String id, Long apiSpaceId) {
        final Long headSpaceId = SpaceInfoUtil.getSpaceId();
        final Long spaceId = headSpaceId != null ? (apiSpaceId == null ? headSpaceId : apiSpaceId) : apiSpaceId;

        boolean specFlag = false;
        ConfigInfo specialUser = configInfoMapper.getByCategoryAndCode("SPECIAL_USER", "workflow-all-view");
        if (specialUser != null && Objects.equals(specialUser.getValue(), UserInfoManagerHandler.getUserId())) {
            specFlag = true;
        }

        final Workflow workflow;
        if (id.length() >= 19) {
            workflow = getOne(Wrappers.lambdaQuery(Workflow.class).eq(Workflow::getFlowId, id));
        } else {
            workflow = getById(Long.parseLong(id));
        }
        if (workflow == null) {
            throw new BusinessException(ResponseEnum.WORKFLOW_NOT_EXIST);
        }

        if (!specFlag) {
            dataPermissionCheckTool.checkWorkflowVisibleForDetail(workflow, spaceId);
        }

        // Tool/node version tips
        workflow.setData(buildFlowToolLastVersion(workflow.getData()));
        workflow.setData(buildFlowLastVersion(workflow.getData()));
        workflow.setData(buildFlowRpaLastVersion(workflow.getData()));
        WorkflowVo vo = new WorkflowVo();
        org.springframework.beans.BeanUtils.copyProperties(workflow, vo);
        vo.setAddress(s3Util.getS3Prefix());
        vo.setColor(workflow.getAvatarColor());
        vo.setSourceCode(String.valueOf(CommonConst.PlatformCode.COMMON));
        // Is it a voice intelligent agent
        if (Objects.equals(workflow.getType(), BotTypeEnum.TALK.getType())) {
            WorkflowConfig workflowConfig = workflowConfigMapper.selectOne(new LambdaQueryWrapper<WorkflowConfig>()

View on GitHub (pinned to 5e758547a8)