iflytek/astron-agent · error · BusinessException

REPO_FILE_NAME_CANNOT_EMPTY

REPO_FILE_NAME_CANNOT_EMPTY

Error message

REPO_FILE_NAME_CANNOT_EMPTY

What it means

createFolder validates the requested folder name first: ObjectIsNull.check(name) detects an empty/blank name and throws BusinessException(REPO_FILE_NAME_CANNOT_EMPTY). A folder must have a non-empty name before character-legality and parent/repo resolution can proceed.

Solutions

  1. Populate CreateFolderVO.name with the intended folder name before calling the API.
  2. Add required-field validation on the client form so submission is blocked when name is blank.
  3. Trim input server-side before ObjectIsNull.check if whitespace-only names should be treated as valid content.

Example fix

// before
CreateFolderVO vo = new CreateFolderVO();
vo.setName("");
fileInfoV2Service.createFolder(vo);
// after
CreateFolderVO vo = new CreateFolderVO();
vo.setName("reports");
fileInfoV2Service.createFolder(vo);
Defensive patterns

Strategy: validation

Validate before calling

if (name == null || name.trim().isEmpty()) {
    // block submission / show 'name is required' in UI
    return;
}

Try / catch

try {
    fileInfoV2Service.createFolder(vo);
} catch (BusinessException e) {
    if ("REPO_FILE_NAME_CANNOT_EMPTY".equals(e.getCode())) {
        // mark name field as required error
    }
}

Prevention

When it happens

Trigger: Calling createFolder with a CreateFolderVO whose name is null, empty string, or whitespace-only — e.g. user clicked 'create folder' without typing a name, or the client sent an unset name field.

Common situations: Frontend form submitted with empty input because required-field validation is missing; API consumers omitting "name" in the JSON body; automated scripts building VOs with default empty strings.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


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

Appendix: source

Thrown at console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/repo/FileInfoV2Service.java:1887

        }

        pageData.setTotalCount(modelListCount);
        pageData.setPageData(fileDirectoryTreeDtoList);
        return pageData;
    }

    /**
     * Create a new folder in the repository
     *
     * @param folderVO folder creation parameters containing name, repository ID, and parent ID
     * @throws BusinessException if folder name is empty, contains illegal characters, or repository
     *         access is denied
     */
    public void createFolder(CreateFolderVO folderVO) {
        String name = folderVO.getName();
        Pattern pattern = Pattern.compile("[\\\\/:*?\"<>|]");
        if (ObjectIsNull.check(name)) {
            throw new BusinessException(ResponseEnum.REPO_FILE_NAME_CANNOT_EMPTY);
        } else {
            boolean flag = pattern.matcher(name).find();
            if (flag) {
                throw new BusinessException(ResponseEnum.REPO_FOLDER_NAME_ILLEGAL);
            }
        }
        Long parentId = folderVO.getParentId();

        Repo repo = repoService.getById(folderVO.getRepoId());
        if (repo != null) {
            dataPermissionCheckTool.checkRepoBelong(repo);
        }

        FileDirectoryTree fileDirectoryTree;
        // Non-empty means a folder with the same name exists in the same directory, user creation is not
        // allowed
        /*
         * if (!ObjectIsNull.check(fileDirectoryTree)) { throw new

View on GitHub (pinned to 5e758547a8)