{"record":{"id":"79034d95e1b3588f","repo":"apache/hadoop","slug":"har-append-not-allowed","errorCode":null,"errorMessage":"Har: append not allowed.","messagePattern":"Har: append 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":730,"sourceCode":"  }\n\n  @Override\n  public FSDataOutputStream create(Path f, FsPermission permission,\n      boolean overwrite, int bufferSize, short replication, long blockSize,\n      Progressable progress) throws IOException {\n    throw new IOException(\"Har: create not allowed.\");\n  }\n\n  @Override\n  public FSDataOutputStream createNonRecursive(Path f, boolean overwrite,\n      int bufferSize, short replication, long blockSize, Progressable progress)\n      throws IOException {\n    throw new IOException(\"Har: create not allowed.\");\n  }\n\n  @Override\n  public FSDataOutputStream append(Path f, int bufferSize, Progressable progress) throws IOException {\n    throw new IOException(\"Har: append not allowed.\");\n  }\n\n  @Override\n  public void close() throws IOException {\n    super.close();\n    if (fs != null) {\n      try {\n        fs.close();\n      } catch(IOException ie) {\n        //this might already be closed\n        // ignore\n      }\n    }\n  }\n  \n  /**\n   * Not implemented.\n   */","sourceCodeStart":712,"sourceCodeEnd":748,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/HarFileSystem.java#L712-L748","documentation":"The three-argument append(Path, int, Progressable) override throws 'Har: append not allowed' because har members are byte ranges inside immutable part files; appending would require rewriting archive internals. HarFileSystem supports only read operations.","triggerScenarios":"fs.append(harPath, bufferSize, progress) on any har:// path — e.g., append-style log writers, or copy utilities with an append flag that resolve their destination to the har filesystem.","commonSituations":"Log-aggregation or sink code configured with a har:// base path; tools that fall back to append when a destination file exists.","solutions":["Append to a regular file on the underlying HDFS and rebuild the archive when needed","Move append-based data flows off har:// entirely — archives are for cold, immutable data","Validate destination scheme before choosing the append code path"],"exampleFix":"// before\nfs.append(new Path(\"har://hdfs-nn:8020/a/data.har/log.txt\"), 4096, null);\n\n// after\nhdfs.append(new Path(\"hdfs://nn:8020/a/logs/log.txt\"), 4096, null);","handlingStrategy":"validation","validationCode":"if (\"har\".equals(dst.toUri().getScheme())) {\n  throw new UnsupportedOperationException(\"append is not supported on har: \" + dst);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never configure append-based sinks (logs, streams) with a har:// base path","Check for existing-file-append fallbacks in copy utilities before pointing them at archives"],"tags":["hadoop","har-filesystem","read-only","append"],"backgroundTag":"read-only-filesystem-write","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}