iflytek/astron-agent · error · BusinessException

TOOLBOX_NOT_EXIST_MODIFY

TOOLBOX_NOT_EXIST_MODIFY

Error message

BusinessException(ResponseEnum.TOOLBOX_NOT_EXIST_MODIFY)

What it means

createTool throws BusinessException(TOOLBOX_NOT_EXIST_MODIFY) when the DTO carries an id but no matching ToolBox record exists (after permission checks). It means the client attempted to modify/update a toolbox tool that is not in the database.

Solutions

  1. Confirm the tool id exists (getById / list tools) before sending it in the DTO.
  2. Omit id (send null) to create a new tool instead of updating.
  3. Refresh the tool list in the UI and retry with a valid id.
  4. Catch TOOLBOX_NOT_EXIST_MODIFY and prompt the user that the tool was removed.

Example fix

// before
dto.setId(123L); // tool 123 was deleted
service.createTool(dto); // throws
// after
if (toolBoxService.getById(123L) == null) dto.setId(null); // create new
service.createTool(dto);
Defensive patterns

Strategy: validation

Validate before calling

if (dto.getId() != null && toolBoxService.getById(dto.getId()) == null) { dto.setId(null); /* or abort */ }

Type guard

boolean toolExists(Long id) { return id == null || toolBoxService.getById(id) != null; }

Try / catch

try { service.createTool(dto); } catch (BusinessException e) { if (ResponseEnum.TOOLBOX_NOT_EXIST_MODIFY.equals(e.getCode())) { refreshToolList(); notifyToolDeleted(dto.getId()); } else { throw e; } }

Prevention

When it happens

Trigger: Submitting createTool with an id that no longer exists in the tool box table (upsert-style call where the id is stale).

Common situations: Concurrent deletion by another user before the update lands; frontend caching an old tool id after the tool was removed; copying a payload with an id from another environment/tenant.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


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

Appendix: source

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

    private static final String FAVORITE_KEY_PREFIX = "new:user:favorite:tool:";

    private static final String CONFIG_KEY_PREFIX = "spark_bot:tool_config:";
    private static final String TOOL_HEAT_VALUE_PREFIX = "spark_bot:tool:heat_value:";



    @Transactional
    public ToolBox createTool(ToolBoxDto toolBoxDto) {

        ToolBox toolBox;
        if (toolBoxDto.getId() != null) {
            toolBox = getById(toolBoxDto.getId());
            if (toolBox != null) {
                // Add permission validation
                dataPermissionCheckTool.checkToolBelong(toolBox);
            } else {
                throw new BusinessException(ResponseEnum.TOOLBOX_NOT_EXIST_MODIFY);
            }
        } else {
            toolBox = new ToolBox();
        }
        // Validate the endpoint submitted in this request before it is copied to the entity or sent
        // to the tool service. Validating the existing entity would miss new and changed endpoints.
        if (StringUtils.isNotBlank(toolBoxDto.getEndPoint())) {
            urlCheckTool.checkUrl(toolBoxDto.getEndPoint());
        }
        toolBoxDto.setVersion("V1.0");
        String schemaString = buildToolBox(toolBox, toolBoxDto);
        ToolProtocolDto toolProtocolDto = buildToolRequest(toolBoxDto, schemaString);
        ToolResp toolCreateResp = toolServiceCallHandler.toolCreate(toolProtocolDto);
        toolServiceCallHandler.dealResult(toolCreateResp);
        String toolId = ((JSONObject) toolCreateResp.getData()).getJSONArray("tools").getObject(0, Tool.class).getId();
        toolBox.setToolId(toolId);
        // Clear temporary data
        toolBox.setTemporaryData(StringUtils.EMPTY);

View on GitHub (pinned to 5e758547a8)