{"record":{"id":"c8cda17ec0d54009","repo":"apache/hadoop","slug":"msg-consider-using-skiptrash-option","errorCode":null,"errorMessage":"${msg}. Consider using -skipTrash option","messagePattern":"(.+?)\\. Consider using -skipTrash option","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Delete.java","lineNumber":163,"sourceCode":"          }\n        }\n      }\n      return shouldDelete;\n    }\n\n    private boolean moveToTrash(PathData item) throws IOException {\n      boolean success = false;\n      if (!skipTrash) {\n        try {\n          success = Trash.moveToAppropriateTrash(item.fs, item.path, getConf());\n        } catch(FileNotFoundException fnfe) {\n          throw fnfe;\n        } catch (IOException ioe) {\n          String msg = ioe.getMessage();\n          if (ioe.getCause() != null) {\n            msg += \": \" + ioe.getCause().getMessage();\n          }\n          throw new IOException(msg + \". Consider using -skipTrash option\", ioe);\n        }\n      }\n      return success;\n    }\n  }\n  \n  /** remove any path */\n  static class Rmr extends Rm {\n    public static final String NAME = \"rmr\";\n    \n    @Override\n    protected void processOptions(LinkedList<String> args) throws IOException {\n      args.addFirst(\"-r\");\n      super.processOptions(args);\n    }\n\n    @Override\n    public String getReplacementCommand() {","sourceCodeStart":145,"sourceCodeEnd":181,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/Delete.java#L145-L181","documentation":"IOException thrown by Rm.moveToTrash (Delete.java:163): 'hadoop fs -rm' first tries Trash.moveToAppropriateTrash (because trash is enabled, i.e. skipTrash==false); that call failed with an IOException that is NOT a FileNotFoundException. The shell appends the underlying message plus '. Consider using -skipTrash option', so the text before the suffix is the real cause.","triggerScenarios":"Trash enabled (fs.trash.interval > 0) but the trash checkpoint directory cannot be created: the user lacks write permission on /user/<user>/.Trash on HDFS; a .Trash path occupied by a file rather than a directory; filesystems whose trash support is limited (some object stores); a quota limit hit while moving into trash.","commonSituations":"Shared clusters where admins restricted /user directories; deleting with a proxy user whose home is not writable; migrations from local FS to s3a/abfs where trash semantics differ; trash checkpoint misconfiguration making the current checkpoint unusable.","solutions":["Read the message before the suffix — it names the actual trash failure; fix that (usually permissions on /user/<user>/.Trash)","If immediate deletion is acceptable, rerun with the flag the message suggests: 'hadoop fs -rm -skipTrash /path'","Ask your admin to repair the .Trash hierarchy permissions, or recreate the checkpoint ('hadoop fs -expunge')","For scripts where trash is never wanted, make -skipTrash the default and document it"],"exampleFix":"# before\nhadoop fs -rm /data/stale-file      # trash failure text ... Consider using -skipTrash option\n\n# after (immediate deletion acceptable)\nhadoop fs -rm -skipTrash /data/stale-file","handlingStrategy":"fallback","validationCode":"// probe trash before a batch of rm operations\nPath probe = new Path(fs.getWorkingDirectory(), \".rm-probe-\" + System.nanoTime());\nfs.create(probe, false).close();\nboolean trashWorks;\ntry {\n  trashWorks = Trash.moveToAppropriateTrash(fs, probe, conf);\n} catch (IOException ioe) {\n  trashWorks = false; // plan on -skipTrash for this batch\n}\nfs.delete(probe, false);","typeGuard":null,"tryCatchPattern":"try {\n  success = Trash.moveToAppropriateTrash(fs, path, conf);\n} catch (FileNotFoundException fnfe) {\n  throw fnfe;\n} catch (IOException ioe) {\n  String msg = ioe.getMessage();\n  if (ioe.getCause() != null) msg += \": \" + ioe.getCause().getMessage();\n  throw new IOException(msg + \". Consider using -skipTrash option\", ioe);\n}","preventionTips":["Verify the user can write /user/<user>/.Trash before relying on trash","Use -skipTrash in automation where trash is not required","Run 'hadoop fs -expunge' after fixing trash permissions to rebuild checkpoints"],"tags":["hadoop","trash","rm","permissions","shell","skip-trash"],"backgroundTag":"trash-move-failed","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}