{"record":{"id":"65e52b7011143346","repo":"apache/hadoop","slug":"can-t-provision-trash-for-snapshottable-directory","errorCode":null,"errorMessage":"Can't provision trash for snapshottable directory {} because trash path {} already exists.","messagePattern":"Can't provision trash for snapshottable directory (.+?) because trash path (.+?) already exists\\.","errorType":"exception","errorClass":"FileAlreadyExistsException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DistributedFileSystem.java","lineNumber":3213,"sourceCode":"    try {\n      FileStatus trashFileStatus = getFileStatus(trashPath);\n      boolean throwException = false;\n      String errMessage = \"Can't provision trash for snapshottable directory \" +\n          pathStr + \" because trash path \" + trashPath.toString() +\n          \" already exists.\";\n      if (!trashFileStatus.isDirectory()) {\n        throwException = true;\n        errMessage += \"\\r\\n\" +\n            \"WARNING: \" + trashPath.toString() + \" is not a directory.\";\n      }\n      if (!trashFileStatus.getPermission().equals(trashPermission)) {\n        throwException = true;\n        errMessage += \"\\r\\n\" +\n            \"WARNING: Permission of \" + trashPath.toString() +\n            \" differs from provided permission \" + trashPermission;\n      }\n      if (throwException) {\n        throw new FileAlreadyExistsException(errMessage);\n      }\n    } catch (FileNotFoundException ignored) {\n      // Trash path doesn't exist. Continue\n    }\n\n    // Create trash root and set the permission\n    mkdir(trashPath, trashPermission);\n    setPermission(trashPath, trashPermission);\n\n    // Print a warning if snapshot trash root feature is not enabled\n    if (!isSnapshotTrashRootEnabled()) {\n      DFSClient.LOG.warn(\"New trash is provisioned, but the snapshot trash root\"\n          + \" feature is disabled. This new trash but won't be automatically\"\n          + \" utilized unless the feature is enabled on the NameNode.\");\n    }\n    return trashPath;\n  }\n","sourceCodeStart":3195,"sourceCodeEnd":3231,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DistributedFileSystem.java#L3195-L3231","documentation":"Error \"Can't provision trash for snapshottable directory {} because trash path {} already exists.\" thrown in apache/hadoop.","triggerScenarios":"Trash provisioning for a snapshottable directory fails because the computed trash path already exists; it must be renamed or removed first.","commonSituations":"See trigger scenarios.","solutions":["Delete or rename the existing trash path, then retry provisioning.","Reuse the existing trash directory if it is already correct."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}