{"record":{"id":"97e5878a31a5503a","repo":"iflytek/astron-agent","slug":"repo-file-name-cannot-empty","errorCode":"REPO_FILE_NAME_CANNOT_EMPTY","errorMessage":"REPO_FILE_NAME_CANNOT_EMPTY","messagePattern":"REPO_FILE_NAME_CANNOT_EMPTY","errorType":"error_code","errorClass":"BusinessException","httpStatus":null,"severity":"error","filePath":"console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/repo/FileInfoV2Service.java","lineNumber":1887,"sourceCode":"        }\n\n        pageData.setTotalCount(modelListCount);\n        pageData.setPageData(fileDirectoryTreeDtoList);\n        return pageData;\n    }\n\n    /**\n     * Create a new folder in the repository\n     *\n     * @param folderVO folder creation parameters containing name, repository ID, and parent ID\n     * @throws BusinessException if folder name is empty, contains illegal characters, or repository\n     *         access is denied\n     */\n    public void createFolder(CreateFolderVO folderVO) {\n        String name = folderVO.getName();\n        Pattern pattern = Pattern.compile(\"[\\\\\\\\/:*?\\\"<>|]\");\n        if (ObjectIsNull.check(name)) {\n            throw new BusinessException(ResponseEnum.REPO_FILE_NAME_CANNOT_EMPTY);\n        } else {\n            boolean flag = pattern.matcher(name).find();\n            if (flag) {\n                throw new BusinessException(ResponseEnum.REPO_FOLDER_NAME_ILLEGAL);\n            }\n        }\n        Long parentId = folderVO.getParentId();\n\n        Repo repo = repoService.getById(folderVO.getRepoId());\n        if (repo != null) {\n            dataPermissionCheckTool.checkRepoBelong(repo);\n        }\n\n        FileDirectoryTree fileDirectoryTree;\n        // Non-empty means a folder with the same name exists in the same directory, user creation is not\n        // allowed\n        /*\n         * if (!ObjectIsNull.check(fileDirectoryTree)) { throw new","sourceCodeStart":1869,"sourceCodeEnd":1905,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/repo/FileInfoV2Service.java#L1869-L1905","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Populate CreateFolderVO.name with the intended folder name before calling the API.","Add required-field validation on the client form so submission is blocked when name is blank.","Trim input server-side before ObjectIsNull.check if whitespace-only names should be treated as valid content."],"exampleFix":"// before\nCreateFolderVO vo = new CreateFolderVO();\nvo.setName(\"\");\nfileInfoV2Service.createFolder(vo);\n// after\nCreateFolderVO vo = new CreateFolderVO();\nvo.setName(\"reports\");\nfileInfoV2Service.createFolder(vo);","handlingStrategy":"validation","validationCode":"if (name == null || name.trim().isEmpty()) {\n    // block submission / show 'name is required' in UI\n    return;\n}","typeGuard":null,"tryCatchPattern":"try {\n    fileInfoV2Service.createFolder(vo);\n} catch (BusinessException e) {\n    if (\"REPO_FILE_NAME_CANNOT_EMPTY\".equals(e.getCode())) {\n        // mark name field as required error\n    }\n}","preventionTips":["Make the folder-name input required in the create dialog.","Trim whitespace before submit so blank-but-spaced values are caught early.","Never construct CreateFolderVO without explicitly setting a name."],"tags":["empty-required-field","validation"],"backgroundTag":"empty-required-field","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-19T12:17:13.211Z"}