{"record":{"id":"62a64aff8558ac01","repo":"apache/dolphinscheduler","slug":"the-path-is-not-a-directory-directoryabsolutepa","errorCode":null,"errorMessage":"The path is not a directory: ${directoryAbsolutePath}","messagePattern":"The path is not a directory: (.+?)","errorType":"validation","errorClass":"ServiceException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/validator/resource/CreateDirectoryDtoValidator.java","lineNumber":47,"sourceCode":"import com.google.common.io.Files;\n\n@Component\npublic class CreateDirectoryDtoValidator extends AbstractResourceValidator<CreateDirectoryDto> {\n\n    public CreateDirectoryDtoValidator(StorageOperator storageOperator, TenantDao tenantDao) {\n        super(storageOperator, tenantDao);\n    }\n\n    @Override\n    public void validate(CreateDirectoryDto createDirectoryDto) {\n        String directoryAbsolutePath = createDirectoryDto.getDirectoryAbsolutePath();\n\n        exceptionResourceAbsolutePathInvalidated(directoryAbsolutePath);\n        exceptionResourceExists(directoryAbsolutePath);\n        exceptionUserNoResourcePermission(createDirectoryDto.getLoginUser(), directoryAbsolutePath);\n        exceptionResourceIsNotDirectory(directoryAbsolutePath);\n        if (StringUtils.isNotEmpty(Files.getFileExtension(directoryAbsolutePath))) {\n            throw new ServiceException(\"The path is not a directory: \" + directoryAbsolutePath);\n        }\n    }\n}\n","sourceCodeStart":29,"sourceCodeEnd":51,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/validator/resource/CreateDirectoryDtoValidator.java#L29-L51","documentation":"CreateDirectoryDtoValidator.validate throws this ServiceException when the directory path requested for creation carries a non-empty file extension, so the validator concludes it names a file, not a directory. This duplicates the exceptionResourceIsNotDirectory check immediately above it in the same method.","triggerScenarios":"Calling the create-directory API with a path like '/tenant/resources/data.txt' (any dot-suffixed last segment); the check runs after existence and permission checks pass.","commonSituations":"Users typing a directory name containing a dot (e.g. 'backup.2024'); front-end passing the wrong field (fileName instead of directory path); copy-paste of a file path as the target directory.","solutions":["Remove the extension-like suffix from the requested directory name (use 'backup-2024' not 'backup.2024').","Send the parent directory in the correct request field and put the new folder name in directoryName.","If you actually want a file, use the create-file API instead."],"exampleFix":"// before\ncreateDirectory(loginUser, \"/tenant/resources/archive.old\");\n// after\ncreateDirectory(loginUser, \"/tenant/resources/archive-old\");","handlingStrategy":"validation","validationCode":"if (!org.apache.commons.io.FilenameUtils.getExtension(newDirPath).isEmpty()) { throw new IllegalArgumentException(\"Directory name must not have an extension: \" + newDirPath); }","typeGuard":"boolean isValidNewDirectoryName(String p) { return org.apache.commons.io.FilenameUtils.getExtension(p).isEmpty(); }","tryCatchPattern":null,"preventionTips":["Avoid dots in new directory names (use dashes instead).","Send the new folder name in directoryName and the existing parent in the parent field.","Use create-file APIs for paths that intentionally have extensions."],"tags":["resource","directory","validation","dolphinscheduler"],"backgroundTag":"path-is-not-a-directory","analyzedSha":"02eac45a1b6676e639fcbfb4be2243de5771b05d","analyzedAt":"2026-09-06T17:43:00.555Z","contentChangedAt":"2026-09-06T17:43:00.555Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}