{"record":{"id":"0ec06d1f2c0fb2ff","repo":"iflytek/astron-agent","slug":"8114-workflow-version-not-found","errorCode":"8114","errorMessage":"workflow.version.not.found","messagePattern":"workflow\\.version\\.not\\.found","errorType":"error_code","errorClass":"BusinessException","httpStatus":null,"severity":"error","filePath":"console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/workflow/VersionService.java","lineNumber":440,"sourceCode":"            return 0D;\n        }\n    }\n\n    /**\n     * Check if version has system data.\n     *\n     * @param createDto Version check parameters\n     * @return API result with availability flag\n     */\n    public ApiResult<JSONObject> haveVersionSysData(WorkflowVersion createDto) {\n        Workflow workflow = requireWorkflow(createDto.getFlowId());\n        dataPermissionCheckTool.checkWorkflowVisible(workflow, SpaceInfoUtil.getSpaceId());\n        List<WorkflowVersion> workflowVersions = workflowVersionMapper.selectList(Wrappers.lambdaQuery(WorkflowVersion.class)\n                .eq(WorkflowVersion::getFlowId, createDto.getFlowId())\n                .eq(WorkflowVersion::getDeleted, false)\n                .eq(WorkflowVersion::getName, createDto.getName()));\n        if (workflowVersions.isEmpty()) {\n            throw new BusinessException(ResponseEnum.WORKFLOW_VERSION_NOT_FOUND);\n        }\n        boolean haveSysData = workflowVersions.stream()\n                .noneMatch(wv -> WorkflowConst.PublishResult.isSuccess(wv.getPublishResult()));\n        return ApiResult.success(new JSONObject()\n                .fluentPut(\"haveSysData\", haveSysData));\n    }\n\n    /**\n     * Increment version number based on type.\n     *\n     * @param maxVersion Current maximum version\n     * @param type Whether to increment (true) or keep same (false)\n     * @return New version string\n     */\n    public static String incrementVersion(String maxVersion, Boolean type) {\n        if (maxVersion == null) {\n            return \"v1.0\";\n        }","sourceCodeStart":422,"sourceCodeEnd":458,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/workflow/VersionService.java#L422-L458","documentation":"haveVersionSysData throws WORKFLOW_VERSION_NOT_FOUND (code 8114) when no non-deleted workflow_version row matches the given flowId + name. The name lookup is exact, so any mismatch between the requested name and stored version names triggers this.","triggerScenarios":"haveVersionSysData is called with createDto.flowId + createDto.name and selectList returns an empty list — the named version does not exist, is logically deleted, or belongs to a different flowId.","commonSituations":"Client caches a version name that was later logically deleted; case/whitespace mismatch in the name; querying after the version was deleted by another user; wrong flowId paired with a valid name.","solutions":["Verify the exact version name via the version list API for that flowId (names are matched exactly)","Check the row: SELECT * FROM workflow_version WHERE flow_id = ? AND name = ? AND deleted = 0","Re-fetch the current version list instead of using a cached name","If the version was deleted, restore it or reference an existing version"],"exampleFix":"// before\nsvc.haveVersionSysData(dtoWithNameFromOldCache);\n// after\nList<WorkflowVersion> versions = workflowVersionMapper.selectList(\n    new LambdaQueryWrapper<WorkflowVersion>().eq(WorkflowVersion::getFlowId, flowId)\n        .eq(WorkflowVersion::getDeleted, false));\nif (versions.stream().noneMatch(v -> v.getName().equals(name))) {\n    throw new BusinessException(ResponseEnum.WORKFLOW_VERSION_NOT_FOUND);\n}","handlingStrategy":"validation","validationCode":"Integer count = workflowVersionMapper.selectCount(new LambdaQueryWrapper<WorkflowVersion>()\n    .eq(WorkflowVersion::getFlowId, flowId)\n    .eq(WorkflowVersion::getDeleted, false)\n    .eq(WorkflowVersion::getName, name.trim()));\nif (count == 0) { /* version does not exist — do not call haveVersionSysData */ }","typeGuard":"boolean versionExists(String flowId, String name) {\n    return workflowVersionMapper.selectCount(new LambdaQueryWrapper<WorkflowVersion>()\n        .eq(WorkflowVersion::getFlowId, flowId)\n        .eq(WorkflowVersion::getDeleted, false)\n        .eq(WorkflowVersion::getName, name)) > 0;\n}","tryCatchPattern":"try {\n    return svc.haveVersionSysData(dto);\n} catch (BusinessException e) {\n    if (e.getCode() == 8114) { return emptyResult(); }\n    throw e;\n}","preventionTips":["Fetch the version name from the live version list, not client cache","Trim/normalize the name before sending","Refetch after any delete operation on versions","Confirm flowId and name belong together (same flow)"],"tags":["java","workflow","not-found"],"backgroundTag":"record-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"}