{"record":{"id":"57015883ded68afa","repo":"apache/hadoop","slug":"har-setowner-not-allowed","errorCode":null,"errorMessage":"Har: setowner not allowed","messagePattern":"Har: setowner not allowed","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/HarFileSystem.java","lineNumber":875,"sourceCode":"    throw new IOException(\"Har: startLocalOutput not allowed\");\n  }\n  \n  /**\n   * not implemented.\n   */\n  @Override\n  public void completeLocalOutput(Path fsOutputFile, Path tmpLocalFile) \n    throws IOException {\n    throw new IOException(\"Har: completeLocalOutput not allowed\");\n  }\n  \n  /**\n   * not implemented.\n   */\n  @Override\n  public void setOwner(Path p, String username, String groupname)\n    throws IOException {\n    throw new IOException(\"Har: setowner not allowed\");\n  }\n\n  @Override\n  public void setTimes(Path p, long mtime, long atime) throws IOException {\n    throw new IOException(\"Har: setTimes not allowed\");\n  }\n\n  /**\n   * Not implemented.\n   */\n  @Override\n  public void setPermission(Path p, FsPermission permission)\n    throws IOException {\n    throw new IOException(\"Har: setPermission not allowed\");\n  }\n\n  /**\n   * Declare that this filesystem connector is always read only.","sourceCodeStart":857,"sourceCodeEnd":893,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/HarFileSystem.java#L857-L893","documentation":"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.","triggerScenarios":"fs.setOwner(harPath, user, group) on any har:// path — chown-style tooling, permission-normalization scripts, or distcp -p style attribute propagation touching archived paths.","commonSituations":"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.","solutions":["Set ownership on the physical archive files with the underlying filesystem: hdfs.setOwner(new Path(\"hdfs://nn:8020/a/data.har\"), \"u\", \"g\")","Exclude har:// URIs from chown/permission scripts (filter on scheme)","Set correct ownership on the source tree before running `hadoop archive` so the index records it"],"exampleFix":"// before\nharFs.setOwner(new Path(\"har://hdfs-nn:8020/a/data.har/f.txt\"), \"etl\", \"analytics\");\n\n// after\nhdfs.setOwner(new Path(\"hdfs://nn:8020/a/data.har\"), \"etl\", \"analytics\");","handlingStrategy":"validation","validationCode":"if (\"har\".equals(p.toUri().getScheme())) {\n  // change ownership of the physical archive files instead\n  hdfs.setOwner(underlyingArchivePath, username, groupname);\n} else {\n  fs.setOwner(p, username, groupname);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Filter har:// URIs out of chown/permission-normalization sweeps","Set correct ownership on the source tree before running `hadoop archive`"],"tags":["hadoop","har-filesystem","read-only","setowner","permissions"],"backgroundTag":"read-only-filesystem-write","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}