iflytek/astron-agent · error · BusinessException

TOOLBOX_NOT_EXIST

TOOLBOX_NOT_EXIST

Error message

BusinessException(ResponseEnum.TOOLBOX_NOT_EXIST)

What it means

ToolBoxService.debugTool throws TOOLBOX_NOT_EXIST when getById(id) returns null for the tool being debugged. The debug call is aborted before building the ToolProtocolDto and invoking the tool runtime. This guards the debug endpoint against executing calls on behalf of tools that no longer exist.

Solutions

  1. Fetch a valid tool id from the tool list and retry the debug request.
  2. Refresh the debug UI so it reloads the current tool set before retrying.
  3. Confirm the tool was not deleted; recreate it if debug testing is still needed.
  4. Verify tenant/space headers — the tool may exist under another space context.

Example fix

// before
ToolBox tb = toolBoxService.getById(id);
if (tb == null) { /* tool gone */ }
// after
if (toolBoxService.getById(id) == null) {
    // skip debug or prompt user to select a valid tool
    return;
}
debugTool(id, reqData);
Defensive patterns

Strategy: validation

Validate before calling

if (toolBoxService.getById(id) == null) { /* skip debug: tool no longer exists */ }

Try / catch

try {
    toolBoxService.debugTool(id, reqData);
} catch (BusinessException e) {
    if ("TOOLBOX_NOT_EXIST".equals(e.getCode())) {
        // reload debug panel with current tool list
    }
}

Prevention

When it happens

Trigger: POSTing to the tool debug endpoint with a nonexistent or soft-deleted tool id; debugging a tool after it was deleted in another tab; stale debug panel state after list refresh; id from a different tenant/space.

Common situations: Playground/debug UI kept open while the tool was removed; API clients replaying recorded debug requests with old ids; sharing debug URLs between users without access to the tool.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


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

Appendix: source

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

        if (modelListCount > 0) {
            throw new BusinessException(ResponseEnum.TOOLBOX_CANNOT_DELETE_RELATED);
        }

        toolBoxMapper.update(null, new UpdateWrapper<ToolBox>().lambda()
                .set(ToolBox::getDeleted, true)
                .set(ToolBox::getUpdateTime, new Timestamp(System.currentTimeMillis()))
                .eq(ToolBox::getToolId, toolBox.getToolId()));

        String paramStr = "?app_id=" + commonConfig.getAppId() + "&tool_ids=" + toolBox.getToolId();
        ToolResp toolDelResp = toolServiceCallHandler.toolDelete(paramStr);
        toolServiceCallHandler.dealResult(toolDelResp);
        return ApiResult.success();
    }

    public Object debugTool(Long id, JSONObject reqData) {
        ToolBox toolBox = getById(id);
        if (toolBox == null) {
            throw new BusinessException(ResponseEnum.TOOLBOX_NOT_EXIST);
        }

        // Add permission validation
        dataPermissionCheckTool.checkToolBelong(toolBox);
        ToolProtocolDto request = new ToolProtocolDto();

        ToolHeader header = new ToolHeader();
        header.setUid(toolBox.getUserId());
        header.setAppId(commonConfig.getAppId());
        request.setHeader(header);

        ToolParameter parameter = new ToolParameter();
        parameter.setToolId(toolBox.getToolId());
        parameter.setOperationId(toolBox.getOperationId());

        request.setParameter(parameter);

        ToolPayload payload = new ToolPayload();

View on GitHub (pinned to 5e758547a8)