apache/hadoop · error · IOException

Har: setowner not allowed

Error message

Har: setowner not allowed

What it means

setOwner throws 'Har: setowner not allowed': ownership shown for har entries is metadata recorded in the index at archive creation and cannot be changed through the har filesystem. Only the underlying .har files' ownership can be modified, via the filesystem that hosts them.

Source

Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/HarFileSystem.java:875

    throw new IOException("Har: startLocalOutput not allowed");
  }
  
  /**
   * not implemented.
   */
  @Override
  public void completeLocalOutput(Path fsOutputFile, Path tmpLocalFile) 
    throws IOException {
    throw new IOException("Har: completeLocalOutput not allowed");
  }
  
  /**
   * not implemented.
   */
  @Override
  public void setOwner(Path p, String username, String groupname)
    throws IOException {
    throw new IOException("Har: setowner not allowed");
  }

  @Override
  public void setTimes(Path p, long mtime, long atime) throws IOException {
    throw new IOException("Har: setTimes not allowed");
  }

  /**
   * Not implemented.
   */
  @Override
  public void setPermission(Path p, FsPermission permission)
    throws IOException {
    throw new IOException("Har: setPermission not allowed");
  }

  /**
   * Declare that this filesystem connector is always read only.

View on GitHub (pinned to 2add963021)

Solutions

  1. Set ownership on the physical archive files with the underlying filesystem: hdfs.setOwner(new Path("hdfs://nn:8020/a/data.har"), "u", "g")
  2. Exclude har:// URIs from chown/permission scripts (filter on scheme)
  3. Set correct ownership on the source tree before running `hadoop archive` so the index records it

Example fix

// before
harFs.setOwner(new Path("har://hdfs-nn:8020/a/data.har/f.txt"), "etl", "analytics");

// after
hdfs.setOwner(new Path("hdfs://nn:8020/a/data.har"), "etl", "analytics");
Defensive patterns

Strategy: validation

Validate before calling

if ("har".equals(p.toUri().getScheme())) {
  // change ownership of the physical archive files instead
  hdfs.setOwner(underlyingArchivePath, username, groupname);
} else {
  fs.setOwner(p, username, groupname);
}

Prevention

When it happens

Trigger: fs.setOwner(harPath, user, group) on any har:// path — chown-style tooling, permission-normalization scripts, or distcp -p style attribute propagation touching archived paths.

Common situations: Security baselines running chown sweeps over all registered URIs; administrators fixing ownership after archive creation and accidentally targeting the har:// view instead of the physical files.

Related errors


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