{"record":{"id":"20f889c148e08126","repo":"apache/dolphinscheduler","slug":"directory-already-exists-directoryabsolutepath","errorCode":null,"errorMessage":"Directory already exists: ${directoryAbsolutePath}","messagePattern":"Directory already exists: (.+?)","errorType":"exception","errorClass":"FileAlreadyExistsException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-storage-plugin/dolphinscheduler-storage-api/src/main/java/org/apache/dolphinscheduler/plugin/storage/api/local/LocalStorageOperator.java","lineNumber":69,"sourceCode":"\n    public LocalStorageOperator(String resourceBaseAbsolutePath) throws IOException {\n        super(resourceBaseAbsolutePath);\n        final Path path = Paths.get(resourceBaseAbsolutePath);\n        if (Files.exists(path)) {\n            if (!Files.isDirectory(path)) {\n                throw new IllegalArgumentException(\"The base path must be a directory: \" + resourceBaseAbsolutePath);\n            }\n        } else {\n            Files.createDirectories(path);\n        }\n    }\n\n    @SneakyThrows\n    @Override\n    public void createStorageDir(String directoryAbsolutePath) {\n        final Path path = Paths.get(directoryAbsolutePath);\n        if (exists(directoryAbsolutePath)) {\n            throw new FileAlreadyExistsException(\"Directory already exists: \" + directoryAbsolutePath);\n        }\n        Files.createDirectories(path);\n    }\n\n    @Override\n    public boolean exists(String resourceAbsolutePath) {\n        return Files.exists(Paths.get(resourceAbsolutePath));\n    }\n\n    @SneakyThrows\n    @Override\n    public void delete(String resourceAbsolutePath, boolean recursive) {\n        if (recursive) {\n            FileUtils.deleteQuietly(new File(resourceAbsolutePath));\n        } else {\n            Files.deleteIfExists(Paths.get(resourceAbsolutePath));\n        }\n    }","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-storage-plugin/dolphinscheduler-storage-api/src/main/java/org/apache/dolphinscheduler/plugin/storage/api/local/LocalStorageOperator.java#L51-L87","documentation":"A sentinel guard in the local-storage operator's createStorageDir: Files.exists on the target directory returned true, so creation is refused instead of overwriting. The offending input is directoryAbsolutePath — it fires on repeated uploads or re-creation of an already-present resource directory on local disk; it is not a filesystem error.","triggerScenarios":"Thrown at dolphinscheduler-storage-plugin/dolphinscheduler-storage-api/src/main/java/org/apache/dolphinscheduler/plugin/storage/api/local/LocalStorageOperator.java:69 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check existence before calling createStorageDir and treat existing directories as success","Delete the existing local directory (via delete with recursive=true) when a clean re-create is needed","Make directory creation idempotent by using Files.createDirectories semantics"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}