iflytek/astron-agent · error · BusinessException

8114

8114

Error message

workflow.version.not.found

What it means

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.

Solutions

  1. Verify the exact version name via the version list API for that flowId (names are matched exactly)
  2. Check the row: SELECT * FROM workflow_version WHERE flow_id = ? AND name = ? AND deleted = 0
  3. Re-fetch the current version list instead of using a cached name
  4. If the version was deleted, restore it or reference an existing version

Example fix

// before
svc.haveVersionSysData(dtoWithNameFromOldCache);
// after
List<WorkflowVersion> versions = workflowVersionMapper.selectList(
    new LambdaQueryWrapper<WorkflowVersion>().eq(WorkflowVersion::getFlowId, flowId)
        .eq(WorkflowVersion::getDeleted, false));
if (versions.stream().noneMatch(v -> v.getName().equals(name))) {
    throw new BusinessException(ResponseEnum.WORKFLOW_VERSION_NOT_FOUND);
}
Defensive patterns

Strategy: validation

Validate before calling

Integer count = workflowVersionMapper.selectCount(new LambdaQueryWrapper<WorkflowVersion>()
    .eq(WorkflowVersion::getFlowId, flowId)
    .eq(WorkflowVersion::getDeleted, false)
    .eq(WorkflowVersion::getName, name.trim()));
if (count == 0) { /* version does not exist — do not call haveVersionSysData */ }

Type guard

boolean versionExists(String flowId, String name) {
    return workflowVersionMapper.selectCount(new LambdaQueryWrapper<WorkflowVersion>()
        .eq(WorkflowVersion::getFlowId, flowId)
        .eq(WorkflowVersion::getDeleted, false)
        .eq(WorkflowVersion::getName, name)) > 0;
}

Try / catch

try {
    return svc.haveVersionSysData(dto);
} catch (BusinessException e) {
    if (e.getCode() == 8114) { return emptyResult(); }
    throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


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

Appendix: source

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

            return 0D;
        }
    }

    /**
     * Check if version has system data.
     *
     * @param createDto Version check parameters
     * @return API result with availability flag
     */
    public ApiResult<JSONObject> haveVersionSysData(WorkflowVersion createDto) {
        Workflow workflow = requireWorkflow(createDto.getFlowId());
        dataPermissionCheckTool.checkWorkflowVisible(workflow, SpaceInfoUtil.getSpaceId());
        List<WorkflowVersion> workflowVersions = workflowVersionMapper.selectList(Wrappers.lambdaQuery(WorkflowVersion.class)
                .eq(WorkflowVersion::getFlowId, createDto.getFlowId())
                .eq(WorkflowVersion::getDeleted, false)
                .eq(WorkflowVersion::getName, createDto.getName()));
        if (workflowVersions.isEmpty()) {
            throw new BusinessException(ResponseEnum.WORKFLOW_VERSION_NOT_FOUND);
        }
        boolean haveSysData = workflowVersions.stream()
                .noneMatch(wv -> WorkflowConst.PublishResult.isSuccess(wv.getPublishResult()));
        return ApiResult.success(new JSONObject()
                .fluentPut("haveSysData", haveSysData));
    }

    /**
     * Increment version number based on type.
     *
     * @param maxVersion Current maximum version
     * @param type Whether to increment (true) or keep same (false)
     * @return New version string
     */
    public static String incrementVersion(String maxVersion, Boolean type) {
        if (maxVersion == null) {
            return "v1.0";
        }

View on GitHub (pinned to 5e758547a8)