iflytek/astron-agent · error · BusinessException

TOOLBOX_ADD_VERSION_FAILED

TOOLBOX_ADD_VERSION_FAILED

Error message

BusinessException(ResponseEnum.TOOLBOX_ADD_VERSION_FAILED)

What it means

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.

Solutions

  1. Check server logs for 'Plugin add version failed: toolId:{id}' to find the real underlying exception.
  2. Verify the tool service (core service behind toolServiceCallHandler) is reachable and healthy.
  3. Confirm the update request passes ownership checks (checkToolBelong) and the endpoint URL is valid.
  4. Inspect the tool's stored version value; fix malformed versions like non-numeric parts that break buildVersion.
  5. Retry the update once the transient downstream issue is resolved.
Defensive patterns

Strategy: try-catch

Validate before calling

boolean owned = dataPermissionCheckTool.checkToolBelong(toolBoxService.getById(dto.getId())); // ensure ownership before update
boolean urlOk = dto.getEndPoint() == null || dto.getEndPoint().isBlank() || urlCheckTool.isValid(dto.getEndPoint());

Try / catch

try {
    toolBoxService.updateTool(dto);
} catch (BusinessException e) {
    log.error("Update failed for tool {}", dto.getId(), e); // inspect server log for root cause
}

Prevention

When it happens

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

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

Related errors


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

Appendix: source

Thrown at console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/tool/ToolBoxService.java:366

                toolBoxDto.setIsPublic(toolBox.getIsPublic());
                ToolBox newToolBox = new ToolBox();
                String schemaString = buildToolBox(newToolBox, toolBoxDto);
                // Clear temporary data
                newToolBox.setTemporaryData(StringUtils.EMPTY);
                // Validate endpoint URL legality
                if (StringUtils.isNotBlank(newToolBox.getEndPoint())) {
                    urlCheckTool.checkUrl(newToolBox.getEndPoint());
                }
                save(newToolBox);
                // Tool side add version interface
                ToolProtocolDto toolProtocolDto = buildToolRequest(toolBoxDto, schemaString);
                ToolResp toolCreateResp = toolServiceCallHandler.toolUpdate(toolProtocolDto);
                toolServiceCallHandler.dealResult(toolCreateResp);
                return newToolBox;
            }
        } catch (BusinessException e) {
            log.error("Plugin add version failed: toolId:{}", toolBoxDto.getId(), e);
            throw new BusinessException(ResponseEnum.TOOLBOX_ADD_VERSION_FAILED);
        }
    }

    private static String buildVersion(ToolBox toolBox) {
        String version = toolBox.getVersion();
        if (version == null || version.isEmpty()) {
            version = "V2.0";
        } else {
            String numberPart = version.substring(1);
            String[] versionParts = numberPart.split("\\.");
            if (versionParts.length > 0) {
                int majorVersion = Integer.parseInt(versionParts[0]) + 1;
                version = "V" + majorVersion + "." + versionParts[1];
            } else {
                version = "V2.0";
            }
        }
        return version;

View on GitHub (pinned to 5e758547a8)