{"record":{"id":"67033380a7ec9165","repo":"iflytek/astron-agent","slug":"toolbox-add-version-failed","errorCode":"TOOLBOX_ADD_VERSION_FAILED","errorMessage":"BusinessException(ResponseEnum.TOOLBOX_ADD_VERSION_FAILED)","messagePattern":"BusinessException\\(ResponseEnum\\.TOOLBOX_ADD_VERSION_FAILED\\)","errorType":"error_code","errorClass":"BusinessException","httpStatus":null,"severity":"error","filePath":"console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/tool/ToolBoxService.java","lineNumber":366,"sourceCode":"                toolBoxDto.setIsPublic(toolBox.getIsPublic());\n                ToolBox newToolBox = new ToolBox();\n                String schemaString = buildToolBox(newToolBox, toolBoxDto);\n                // Clear temporary data\n                newToolBox.setTemporaryData(StringUtils.EMPTY);\n                // Validate endpoint URL legality\n                if (StringUtils.isNotBlank(newToolBox.getEndPoint())) {\n                    urlCheckTool.checkUrl(newToolBox.getEndPoint());\n                }\n                save(newToolBox);\n                // Tool side add version interface\n                ToolProtocolDto toolProtocolDto = buildToolRequest(toolBoxDto, schemaString);\n                ToolResp toolCreateResp = toolServiceCallHandler.toolUpdate(toolProtocolDto);\n                toolServiceCallHandler.dealResult(toolCreateResp);\n                return newToolBox;\n            }\n        } catch (BusinessException e) {\n            log.error(\"Plugin add version failed: toolId:{}\", toolBoxDto.getId(), e);\n            throw new BusinessException(ResponseEnum.TOOLBOX_ADD_VERSION_FAILED);\n        }\n    }\n\n    private static String buildVersion(ToolBox toolBox) {\n        String version = toolBox.getVersion();\n        if (version == null || version.isEmpty()) {\n            version = \"V2.0\";\n        } else {\n            String numberPart = version.substring(1);\n            String[] versionParts = numberPart.split(\"\\\\.\");\n            if (versionParts.length > 0) {\n                int majorVersion = Integer.parseInt(versionParts[0]) + 1;\n                version = \"V\" + majorVersion + \".\" + versionParts[1];\n            } else {\n                version = \"V2.0\";\n            }\n        }\n        return version;","sourceCodeStart":348,"sourceCodeEnd":384,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/tool/ToolBoxService.java#L348-L384","documentation":"ToolBoxService.updateTool wraps its whole body in a catch (BusinessException e) that rethrows as TOOLBOX_ADD_VERSION_FAILED. Any failure during the tool-version update flow — including permission denial, URL validation failure, DB save errors, or a failed toolServiceCallHandler.toolUpdate/dealResult call to the downstream tool service — surfaces as this generic 'add version failed' error. The original cause is logged but lost to the caller.","triggerScenarios":"Calling updateTool where the downstream tool service (toolServiceCallHandler.toolUpdate) returns an error handled by dealResult; the new endpoint URL fails urlCheckTool.checkUrl; checkToolBelong denies permission; the DB save of the new version row fails; version string is malformed and buildVersion throws NumberFormatException.","commonSituations":"Tool microservice down or returning 5xx during update; user updates a tool they do not own; endpoint URL invalid or blocked; concurrent update conflicts; corrupt stored version string that cannot be parsed by buildVersion.","solutions":["Check server logs for 'Plugin add version failed: toolId:{id}' to find the real underlying exception.","Verify the tool service (core service behind toolServiceCallHandler) is reachable and healthy.","Confirm the update request passes ownership checks (checkToolBelong) and the endpoint URL is valid.","Inspect the tool's stored version value; fix malformed versions like non-numeric parts that break buildVersion.","Retry the update once the transient downstream issue is resolved."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"boolean owned = dataPermissionCheckTool.checkToolBelong(toolBoxService.getById(dto.getId())); // ensure ownership before update\nboolean urlOk = dto.getEndPoint() == null || dto.getEndPoint().isBlank() || urlCheckTool.isValid(dto.getEndPoint());","typeGuard":null,"tryCatchPattern":"try {\n    toolBoxService.updateTool(dto);\n} catch (BusinessException e) {\n    log.error(\"Update failed for tool {}\", dto.getId(), e); // inspect server log for root cause\n}","preventionTips":["Monitor health of the downstream tool service before bulk updates.","Validate endpoint URLs client-side before submitting updates.","Keep stored version strings well-formed (V<major>.<minor>).","Check tool ownership before attempting updates."],"tags":["tool-management","upstream-call","versioning"],"backgroundTag":"upstream-api-error","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"}