iflytek/astron-agent · error · BusinessException

RESPONSE_FAILED

RESPONSE_FAILED

Error message

Assistant name already exists: 

What it means

RpaAssistantService.create enforces per-user uniqueness of RPA assistant names. If a record with the same userId and assistantName already exists, it throws BusinessException(RESPONSE_FAILED) with 'Assistant name already exists: <name>'.

Solutions

  1. Query the user's existing assistant names first and pick a unique name.
  2. If the existing record is the intended one, call the update endpoint instead of create.
  3. Delete or rename the conflicting assistant, then retry creation.
  4. Catch the exception in the callback and surface a friendly duplicate-name message to the UI.

Example fix

// before
service.create(req with assistantName="bot1"); // second call throws
// after
if (service.nameExists(userId, "bot1")) req = req.withName("bot1-v2");
service.create(req);
Defensive patterns

Strategy: validation

Validate before calling

long exists = assistantMapper.selectCount(new LambdaQueryWrapper<RpaUserAssistant>().eq(RpaUserAssistant::getUserId, uid).eq(RpaUserAssistant::getAssistantName, name));
if (exists > 0) { /* resolve duplicate before create */ }

Type guard

boolean nameAvailable(String name, String uid) { return assistantMapper.selectCount(new LambdaQueryWrapper<RpaUserAssistant>().eq(RpaUserAssistant::getUserId, uid).eq(RpaUserAssistant::getAssistantName, name)) == 0; }

Try / catch

try { service.create(req); } catch (BusinessException e) { if (e.getMessage() != null && e.getMessage().startsWith("Assistant name already exists")) { showDuplicateNameError(req.assistantName()); } else { throw e; } }

Prevention

When it happens

Trigger: POSTing a hot_load_callback / create request whose assistantName matches an existing assistant owned by the same user.

Common situations: Double-submitting a creation form; re-running an RPA load script that already succeeded; migrating assistants with colliding names.

Understand the failure class

Background: "already exists" / EEXIST / FileAlreadyExistsException: what the 'file already exists' error means and how to fix it — this error's family across 37 libraries.

Related errors


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

Appendix: source

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

    private final ApiUrl apiUrl;

    /**
     * Create an RPA assistant with plaintext credentials.
     *
     * @param currentUserId current user ID
     * @param req creation request
     * @return created assistant response
     * @throws IllegalArgumentException if the platform does not exist or field validation fails
     */
    @Transactional
    public RpaAssistantResp create(String currentUserId, CreateRpaAssistantReq req) {
        // 0. Idempotency check: same user, same assistant name is not allowed
        long exists = assistantMapper.selectCount(
                new LambdaQueryWrapper<RpaUserAssistant>()
                        .eq(RpaUserAssistant::getUserId, currentUserId)
                        .eq(RpaUserAssistant::getAssistantName, req.assistantName()));
        if (exists > 0) {
            throw new BusinessException(ResponseEnum.RESPONSE_FAILED, "Assistant name already exists: " + req.assistantName());
        }

        // 1. Read rpa_info platform definition and parse field specs
        List<PlatformFieldSpec> specs = loadPlatformSpecs(req.platformId());
        Map<String, PlatformFieldSpec> specMap = specs.stream()
                .collect(Collectors.toMap(PlatformFieldSpec::getName, s -> s, (a, b) -> a));

        // 2. Validate required fields and types (only required & string check for now)
        Integer count = validate(specMap, req.fields());

        // 3. Insert main assistant record
        String username = UserInfoManagerHandler.get().getUsername();
        RpaUserAssistant assistant = new RpaUserAssistant();
        assistant.setUserId(currentUserId);
        assistant.setUserName(username);
        assistant.setRobotCount(count);
        assistant.setPlatformId(req.platformId());
        assistant.setAssistantName(req.assistantName());

View on GitHub (pinned to 5e758547a8)