{"record":{"id":"94f905d44201130c","repo":"iflytek/astron-agent","slug":"workflow-version-get-max-failed","errorCode":"WORKFLOW_VERSION_GET_MAX_FAILED","errorMessage":"WORKFLOW_VERSION_GET_MAX_FAILED","messagePattern":"WORKFLOW_VERSION_GET_MAX_FAILED","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":1008,"sourceCode":"                                    WorkflowConst.PublishResult.LEGACY_SUCCESS_UPPER)\n                            .orderByDesc(WorkflowVersion::getCreatedTime)\n                            .last(\"LIMIT 1\"));\n\n            if (workflowVersion == null)\n                return null;\n\n            WorkflowVo vo = new WorkflowVo();\n            if (StringUtils.isNotBlank(workflowVersion.getData())) {\n                vo.setIoInversion(getIoTrans(JSON.parseObject(workflowVersion.getData(), BizWorkflowData.class).getNodes()));\n            }\n            vo.setVersion(workflowVersion.getName());\n            vo.setData(workflowVersion.getData());\n            return vo;\n        } catch (BusinessException e) {\n            throw e;\n        } catch (Exception e) {\n            log.error(\"Query workflow maximum version number exception, flowId: {}\", flowId, e);\n            throw new BusinessException(ResponseEnum.WORKFLOW_VERSION_GET_MAX_FAILED);\n        }\n    }\n\n\n    /**\n     * Parse Agent's tools field (supports array string or object array).\n     *\n     * @param jsonString JSON string to parse\n     * @param toolVersionMap Map to store tool versions\n     * @return Updated tool version map\n     */\n    public Map<String, String> parseTools(String jsonString, Map<String, String> toolVersionMap) {\n        JSONArray toolsArray = JSONArray.parseArray(jsonString);\n        if (toolsArray == null || toolsArray.isEmpty())\n            return toolVersionMap;\n\n        Object first = toolsArray.getFirst();\n        if (first instanceof String) {","sourceCodeStart":990,"sourceCodeEnd":1026,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/workflow/WorkflowService.java#L990-L1026","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read the logged 'Query workflow maximum version number exception, flowId: ...' stack trace for the root cause","Verify the workflow_version table exists, is migrated, and has expected non-null columns","Check database connectivity/pool health","If caused by corrupt/null version rows, clean or backfill the version data for that flowId"],"exampleFix":"// before\nthrow new BusinessException(ResponseEnum.WORKFLOW_VERSION_GET_MAX_FAILED);\n// after\nthrow new BusinessException(ResponseEnum.WORKFLOW_VERSION_GET_MAX_FAILED);\n// (keep, but ensure log.error includes flowId + full stack trace for diagnosis)","handlingStrategy":"try-catch","validationCode":"if (flowId == null || flowId.isBlank()) throw new BusinessException(ResponseEnum.WORKFLOW_NOT_EXIST); // avoid querying with null flowId","typeGuard":null,"tryCatchPattern":"try {\n    MaxVersionVO vo = workflowService.getMaxVersion(flowId);\n} catch (BusinessException e) {\n    if (ResponseEnum.WORKFLOW_VERSION_GET_MAX_FAILED.equals(e.getResponseEnum())) {\n        // check server log 'Query workflow maximum version number exception' for flowId\n    }\n}","preventionTips":["Keep workflow_version table migrations current and columns non-null","Avoid manual edits to version rows that leave null columns","Monitor DB pool health; BusinessExceptions pass through, only unexpected failures map to this code"],"tags":["workflow","versioning","database"],"backgroundTag":"database-query-failed","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}