iflytek/astron-agent · error · BusinessException

WORKFLOW_VERSION_GET_MAX_FAILED

WORKFLOW_VERSION_GET_MAX_FAILED

Error message

WORKFLOW_VERSION_GET_MAX_FAILED

What it means

The endpoint querying a workflow's maximum version number catches any non-BusinessException thrown during the query and rethrows it as BusinessException(ResponseEnum.WORKFLOW_VERSION_GET_MAX_FAILED), logging flowId and the root cause. It signals an internal failure while computing the next/current max workflow version, not a business rule violation (BusinessExceptions pass through untouched).

Solutions

  1. Read the logged 'Query workflow maximum version number exception, flowId: ...' stack trace for the root cause
  2. Verify the workflow_version table exists, is migrated, and has expected non-null columns
  3. Check database connectivity/pool health
  4. If caused by corrupt/null version rows, clean or backfill the version data for that flowId

Example fix

// before
throw new BusinessException(ResponseEnum.WORKFLOW_VERSION_GET_MAX_FAILED);
// after
throw new BusinessException(ResponseEnum.WORKFLOW_VERSION_GET_MAX_FAILED);
// (keep, but ensure log.error includes flowId + full stack trace for diagnosis)
Defensive patterns

Strategy: try-catch

Validate before calling

if (flowId == null || flowId.isBlank()) throw new BusinessException(ResponseEnum.WORKFLOW_NOT_EXIST); // avoid querying with null flowId

Try / catch

try {
    MaxVersionVO vo = workflowService.getMaxVersion(flowId);
} catch (BusinessException e) {
    if (ResponseEnum.WORKFLOW_VERSION_GET_MAX_FAILED.equals(e.getResponseEnum())) {
        // check server log 'Query workflow maximum version number exception' for flowId
    }
}

Prevention

When it happens

Trigger: Any exception while loading the max version for a flowId — DB query failure on the workflow_version table, NPE from unexpected nulls in the version rows, mapper/SQL misconfiguration, or errors inside vo.setData(workflowVersion.getData()) mapping.

Common situations: Missing workflow_version table or failed migration; DB connection pool exhaustion; version rows with unexpected null columns after manual data edits; concurrent version writes causing transient query issues.

Understand the failure class

Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.

Related errors


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

Appendix: source

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

                                    WorkflowConst.PublishResult.LEGACY_SUCCESS_UPPER)
                            .orderByDesc(WorkflowVersion::getCreatedTime)
                            .last("LIMIT 1"));

            if (workflowVersion == null)
                return null;

            WorkflowVo vo = new WorkflowVo();
            if (StringUtils.isNotBlank(workflowVersion.getData())) {
                vo.setIoInversion(getIoTrans(JSON.parseObject(workflowVersion.getData(), BizWorkflowData.class).getNodes()));
            }
            vo.setVersion(workflowVersion.getName());
            vo.setData(workflowVersion.getData());
            return vo;
        } catch (BusinessException e) {
            throw e;
        } catch (Exception e) {
            log.error("Query workflow maximum version number exception, flowId: {}", flowId, e);
            throw new BusinessException(ResponseEnum.WORKFLOW_VERSION_GET_MAX_FAILED);
        }
    }


    /**
     * Parse Agent's tools field (supports array string or object array).
     *
     * @param jsonString JSON string to parse
     * @param toolVersionMap Map to store tool versions
     * @return Updated tool version map
     */
    public Map<String, String> parseTools(String jsonString, Map<String, String> toolVersionMap) {
        JSONArray toolsArray = JSONArray.parseArray(jsonString);
        if (toolsArray == null || toolsArray.isEmpty())
            return toolVersionMap;

        Object first = toolsArray.getFirst();
        if (first instanceof String) {

View on GitHub (pinned to 5e758547a8)