{"record":{"id":"e50afa490ae5915b","repo":"iflytek/astron-agent","slug":"8101-workflow-version-get-name-failed","errorCode":"8101","errorMessage":"workflow.version.get.name.failed","messagePattern":"workflow\\.version\\.get\\.name\\.failed","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":411,"sourceCode":"                        .filter(cfg -> extractVersionNumberSafely(cfg.getName()) > 0D)\n                        .max(Comparator\n                                .comparingDouble((WorkflowConfig cfg) -> extractVersionNumberSafely(cfg.getName()))\n                                .thenComparing(WorkflowConfig::getUpdatedTime, Comparator.nullsLast(Date::compareTo)));\n\n                // Compare draft configuration and historical configuration\n                configNoChange = latestNonDraftCfgOpt\n                        .map(WorkflowConfig::getConfig)\n                        .map(latestCfg -> Objects.equals(latestCfg, draftConfig))\n                        .orElse(false);\n            }\n            Boolean advanceConfigChange = Objects.equals(preAdvanceConfig, advancedConfig);\n            Boolean dataNoChange = Objects.equals(workflow_data, data);\n            boolean needBump = !(Boolean.TRUE.equals(dataNoChange) && Boolean.TRUE.equals(advanceConfigChange) && configNoChange);\n            name = incrementVersion(maxName, needBump);\n            return ApiResult.success(new JSONObject()\n                    .fluentPut(\"workflowVersionName\", name));\n        } catch (Exception e) {\n            throw new BusinessException(ResponseEnum.WORKFLOW_VERSION_GET_NAME_FAILED);\n        }\n    }\n\n    private static double extractVersionNumberSafely(String versionName) {\n        if (StrUtil.isBlank(versionName)) {\n            return 0D;\n        }\n        try {\n            return extractVersionNumber(versionName.toLowerCase(Locale.ROOT));\n        } catch (Exception ignore) {\n            return 0D;\n        }\n    }\n\n    /**\n     * Check if version has system data.\n     *\n     * @param createDto Version check parameters","sourceCodeStart":393,"sourceCodeEnd":429,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/workflow/VersionService.java#L393-L429","documentation":"Generic wrapper thrown when generating the next workflow version name fails in buildVersionName. Any unexpected exception while loading existing versions, parsing numeric version suffixes, or incrementing names results in WORKFLOW_VERSION_GET_NAME_FAILED (code 8101).","triggerScenarios":"getVersionNameForSpace or getVersionNameForBoundBotPublish invokes buildVersionName and a non-BusinessException occurs: malformed existing version names, DB query failure, or arithmetic/parsing error in incrementVersion/extractVersionNumberSafely.","commonSituations":"Version names in DB that don't match the expected 'x.y' numeric pattern in unexpected ways; database timeout; null maxName handling; concurrent version creation causing unexpected state.","solutions":["Inspect server logs for the root exception thrown inside buildVersionName","Verify existing version names for the flowId are well-formed numeric names (e.g. 1.0, 1.1); fix corrupt rows if any","Check DB connectivity and workflow_version table health","Retry; if a specific version row has a malformed name, correct or logically delete that row"],"exampleFix":"// before\n} catch (Exception e) {\n    throw new BusinessException(ResponseEnum.WORKFLOW_VERSION_GET_NAME_FAILED);\n}\n// after\n} catch (Exception e) {\n    log.error(\"buildVersionName failed, flowId={}\", createDto.getFlowId(), e);\n    throw new BusinessException(ResponseEnum.WORKFLOW_VERSION_GET_NAME_FAILED);\n}","handlingStrategy":"try-catch","validationCode":"List<WorkflowVersion> versions = workflowVersionMapper.selectList(\n    new LambdaQueryWrapper<WorkflowVersion>().eq(WorkflowVersion::getFlowId, flowId)\n        .eq(WorkflowVersion::getDeleted, false));\nboolean namesWellFormed = versions.stream().allMatch(v ->\n    v.getName() != null && v.getName().matches(\"\\\\d+\\\\.\\\\d+\"));","typeGuard":null,"tryCatchPattern":"try {\n    return buildVersionName(flowId, data, config);\n} catch (Exception e) {\n    log.error(\"version name generation failed\", e);\n    throw new BusinessException(ResponseEnum.WORKFLOW_VERSION_GET_NAME_FAILED);\n}","preventionTips":["Keep version names strictly numeric (major.minor) in the DB","Guard extractVersionNumberSafely against malformed names (it already defaults to 0D)","Add unique constraints/indexes on (flow_id, name) to avoid races","Alert on DB query failures in version-name paths"],"tags":["java","workflow","versioning"],"backgroundTag":"internal-invariant-violation","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"}