apache/hadoop · error · IOException

Failed move {src} to trash.

Error message

Failed move {src} to trash.

What it means

TrashProcedure.moveToTrash() is the final stage of a fedbalance job: after the data is safely on dst, it disposes of src per the trash option. For TRASH it forcibly sets fs.trash.interval=60 and calls Trash.moveToAppropriateTrash(srcFs, src, conf); a false return (a silent failure, not an exception) becomes this IOException. The copy itself already succeeded - only source cleanup failed.

Source

Thrown at hadoop-tools/hadoop-federation-balance/src/main/java/org/apache/hadoop/tools/fedbalance/TrashProcedure.java:77

  @Override
  public boolean execute() throws IOException {
    moveToTrash();
    return true;
  }

  /**
   * Delete source path to trash.
   */
  void moveToTrash() throws IOException {
    Path src = context.getSrc();
    if (srcFs.exists(src)) {
      TrashOption trashOption = context.getTrashOpt();
      switch (trashOption) {
      case TRASH:
        conf.setFloat(FS_TRASH_INTERVAL_KEY, 60);
        if (!Trash.moveToAppropriateTrash(srcFs, src, conf)) {
          throw new IOException("Failed move " + src + " to trash.");
        }
        break;
      case DELETE:
        if (!srcFs.delete(src, true)) {
          throw new IOException("Failed delete " + src);
        }
        LOG.info("{} is deleted.", src);
        break;
      case SKIP:
        break;
      default:
        throw new IOException("Unexpected trash option=" + trashOption);
      }
    }
  }

  public FedBalanceContext getContext() {
    return context;

View on GitHub (pinned to 2add963021)

Solutions

  1. Check the balance user can write the trash area on the src cluster (try 'hdfs dfs -mkdir /user/<u>/.Trash').
  2. Confirm src sits on HDFS (a ChecksumFileSystem); other filesystems may not support trash semantics.
  3. If trash keeps failing, rerun with a different disposal option (-delete or -skip) instead of trash.
  4. Once dst is verified complete, remove src manually ('hdfs dfs -rm -r' with or without trash).
Defensive patterns

Strategy: try-catch

Try / catch

try {
  // trash disposal stage of TrashProcedure / FedBalance run
} catch (IOException e) {
  if (e.getMessage() != null && e.getMessage().contains("to trash")) {
    // data already copied to dst; check .Trash writability or rerun with -delete/-skip, or rm src manually
  }
}

Prevention

When it happens

Trigger: Trash.moveToAppropriateTrash(...) returns false: commonly the source FileSystem does not support/permit trash for that path, the user's .Trash area is not creatable/writable, or the trash move silently fails. Happens with -trash option (default) once the balance copy completed.

Common situations: The balance user has no writable home/.Trash on the src cluster; src on a filesystem that does not implement trash; the src path renamed/removed concurrently between exists() and the move.

Related errors


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/47c7f366f01f61cc. Report an issue: GitHub.