{"record":{"id":"0b7b5ca0cbf08ebb","repo":"apache/hadoop","slug":"archive-path-outputpath-already-exists","errorCode":null,"errorMessage":"Archive path: {outputPath} already exists","messagePattern":"Archive path: (.+?) already exists","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-tools/hadoop-archives/src/main/java/org/apache/hadoop/tools/HadoopArchives.java","lineNumber":483,"sourceCode":"   */\n  void archive(Path parentPath, List<Path> srcPaths, \n      String archiveName, Path dest) throws IOException {\n    checkPaths(conf, srcPaths);\n    int numFiles = 0;\n    long totalSize = 0;\n    FileSystem fs = parentPath.getFileSystem(conf);\n    this.blockSize = conf.getLong(HAR_BLOCKSIZE_LABEL, blockSize);\n    this.partSize = conf.getLong(HAR_PARTSIZE_LABEL, partSize);\n    conf.setLong(HAR_BLOCKSIZE_LABEL, blockSize);\n    conf.setLong(HAR_PARTSIZE_LABEL, partSize);\n    conf.set(DST_HAR_LABEL, archiveName);\n    conf.set(SRC_PARENT_LABEL, fs.makeQualified(parentPath).toString());\n    conf.setInt(HAR_REPLICATION_LABEL, repl);\n    Path outputPath = new Path(dest, archiveName);\n    FileOutputFormat.setOutputPath(conf, outputPath);\n    FileSystem outFs = outputPath.getFileSystem(conf);\n    if (outFs.exists(outputPath)) {\n      throw new IOException(\"Archive path: \"\n          + outputPath.toString() + \" already exists\");\n    }\n    if (outFs.isFile(dest)) {\n      throw new IOException(\"Destination \" + dest.toString()\n          + \" should be a directory but is a file\");\n    }\n    conf.set(DST_DIR_LABEL, outputPath.toString());\n    Credentials credentials = conf.getCredentials();\n    Path[] allPaths = new Path[] {parentPath, dest};\n    TokenCache.obtainTokensForNamenodes(credentials, allPaths, conf);\n    conf.setCredentials(credentials);\n\n    Path stagingArea;\n    try {\n      stagingArea = JobSubmissionFiles.getStagingDir(new Cluster(conf), \n          conf);\n    } catch (InterruptedException ie) {\n      throw new IOException(ie);","sourceCodeStart":465,"sourceCodeEnd":501,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-tools/hadoop-archives/src/main/java/org/apache/hadoop/tools/HadoopArchives.java#L465-L501","documentation":"Error \"Archive path: {outputPath} already exists\" thrown in apache/hadoop.","triggerScenarios":"Thrown at hadoop-tools/hadoop-archives/src/main/java/org/apache/hadoop/tools/HadoopArchives.java:483 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Delete the existing archive at the output path first, or choose a different output path for hadoop archive."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}