{"record":{"id":"22bcc13a9dc31202","repo":"iflytek/astron-agent","slug":"workflow-not-exist-22bcc1","errorCode":"WORKFLOW_NOT_EXIST","errorMessage":"WORKFLOW_NOT_EXIST","messagePattern":"WORKFLOW_NOT_EXIST","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":534,"sourceCode":"     */\n    public WorkflowVo detail(String id, Long apiSpaceId) {\n        final Long headSpaceId = SpaceInfoUtil.getSpaceId();\n        final Long spaceId = headSpaceId != null ? (apiSpaceId == null ? headSpaceId : apiSpaceId) : apiSpaceId;\n\n        boolean specFlag = false;\n        ConfigInfo specialUser = configInfoMapper.getByCategoryAndCode(\"SPECIAL_USER\", \"workflow-all-view\");\n        if (specialUser != null && Objects.equals(specialUser.getValue(), UserInfoManagerHandler.getUserId())) {\n            specFlag = true;\n        }\n\n        final Workflow workflow;\n        if (id.length() >= 19) {\n            workflow = getOne(Wrappers.lambdaQuery(Workflow.class).eq(Workflow::getFlowId, id));\n        } else {\n            workflow = getById(Long.parseLong(id));\n        }\n        if (workflow == null) {\n            throw new BusinessException(ResponseEnum.WORKFLOW_NOT_EXIST);\n        }\n\n        if (!specFlag) {\n            dataPermissionCheckTool.checkWorkflowVisibleForDetail(workflow, spaceId);\n        }\n\n        // Tool/node version tips\n        workflow.setData(buildFlowToolLastVersion(workflow.getData()));\n        workflow.setData(buildFlowLastVersion(workflow.getData()));\n        workflow.setData(buildFlowRpaLastVersion(workflow.getData()));\n        WorkflowVo vo = new WorkflowVo();\n        org.springframework.beans.BeanUtils.copyProperties(workflow, vo);\n        vo.setAddress(s3Util.getS3Prefix());\n        vo.setColor(workflow.getAvatarColor());\n        vo.setSourceCode(String.valueOf(CommonConst.PlatformCode.COMMON));\n        // Is it a voice intelligent agent\n        if (Objects.equals(workflow.getType(), BotTypeEnum.TALK.getType())) {\n            WorkflowConfig workflowConfig = workflowConfigMapper.selectOne(new LambdaQueryWrapper<WorkflowConfig>()","sourceCodeStart":516,"sourceCodeEnd":552,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/workflow/WorkflowService.java#L516-L552","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the id passed matches an existing workflow (query the workflow table by flowId and by id)","Confirm the user has the workflow in the current space (visibility check follows the existence check)","Check whether the workflow was deleted (soft delete) and restore or use the correct id","Guard callers: only call with ids obtained from list/detail APIs, and validate numeric-ness for short ids"],"exampleFix":"// before\nString id = pathVariable; // could be flowId or db id\nWorkflow wf = workflowService.getWorkflowDetail(id, spaceId, false);\n// after\nif (id == null || id.isBlank()) throw new IllegalArgumentException(\"workflow id required\");\nWorkflow wf = workflowService.getWorkflowDetail(id, spaceId, false); // throws WORKFLOW_NOT_EXIST if absent","handlingStrategy":"validation","validationCode":"boolean numeric = id != null && id.chars().allMatch(Character::isDigit);\nif (id == null || id.isBlank() || (numeric && id.length() < 19 && !existsById(Long.parseLong(id)))) {\n    throw new BusinessException(ResponseEnum.WORKFLOW_NOT_EXIST);\n}","typeGuard":"boolean isFlowId(String id) { return id != null && id.length() >= 19; }","tryCatchPattern":"try {\n    WorkflowDetailVO vo = workflowService.getWorkflowDetail(id, spaceId, false);\n} catch (BusinessException e) {\n    if (ResponseEnum.WORKFLOW_NOT_EXIST.equals(e.getResponseEnum())) {\n        // refresh list / notify user the workflow was deleted or is in another space\n    }\n}","preventionTips":["Always pass ids obtained from list/detail APIs, never hand-typed","Distinguish flowId vs numeric DB id consistently across frontend and backend","Handle soft-deleted workflows gracefully in the UI"],"tags":["workflow","not-found","entity-lookup"],"backgroundTag":"entity-not-found","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"}