{"record":{"id":"344ed011a9682645","repo":"apache/hadoop","slug":"couldn-t-rename-mapout","errorCode":null,"errorMessage":"\"Couldn't rename \" + mapOut","messagePattern":"\"Couldn't rename \" \\+ mapOut","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapred/LocalContainerLauncher.java","lineNumber":583,"sourceCode":"      TaskAttemptId mapId, MapOutputFile subMapOutputFile) throws IOException {\n    FileSystem localFs = FileSystem.getLocal(conf);\n    // move map output to reduce input\n    Path mapOut = subMapOutputFile.getOutputFile();\n    FileStatus mStatus = localFs.getFileStatus(mapOut);\n    Path reduceIn = subMapOutputFile.getInputFileForWrite(\n        TypeConverter.fromYarn(mapId).getTaskID(), mStatus.getLen());\n    Path mapOutIndex = subMapOutputFile.getOutputIndexFile();\n    Path reduceInIndex = new Path(reduceIn.toString() + \".index\");\n    if (LOG.isDebugEnabled()) {\n      LOG.debug(\"Renaming map output file for task attempt {} from original location {}\"\n              + \" to destination {}\", mapId, mapOut, reduceIn);\n    }\n    if (!localFs.mkdirs(reduceIn.getParent())) {\n      throw new IOException(\"Mkdirs failed to create \"\n          + reduceIn.getParent().toString());\n    }\n    if (!localFs.rename(mapOut, reduceIn))\n      throw new IOException(\"Couldn't rename \" + mapOut);\n    if (!localFs.rename(mapOutIndex, reduceInIndex))\n      throw new IOException(\"Couldn't rename \" + mapOutIndex);\n\n    return new RenamedMapOutputFile(reduceIn);\n  }\n\n  private static class RenamedMapOutputFile extends MapOutputFile {\n    private Path path;\n    \n    public RenamedMapOutputFile(Path path) {\n      this.path = path;\n    }\n    \n    @Override\n    public Path getOutputFile() throws IOException {\n      return path;\n    }\n","sourceCodeStart":565,"sourceCodeEnd":601,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapred/LocalContainerLauncher.java#L565-L601","documentation":"In uber mode, LocalContainerLauncher renames each map output file into the reduce input slot on the local filesystem. RawLocalFileSystem.rename returns false (rather than throwing) for a cross-volume rename, a missing source, or insufficient permission, and each false becomes IOException('Couldn't rename <mapOut>'). The path in the message is the map attempt's spill/output file under the task's attempt output directory.","triggerScenarios":"Map output and reduce input land on different local-dir volumes (EXDEV); the destination already exists from a previous failed attempt; the attempt dir is owned by another user; the map output file was already moved or deleted.","commonSituations":"Uber jobs on nodes with multiple mapreduce.cluster.local.dir volumes where the dir allocator splits spill and reduce-input paths; leftover files from retried attempts; restrictive umask/ownership under usercache.","solutions":["Check the two paths named in the log (source mapOut and destination reduceIn) with ls -l on the AM node; confirm same volume, ownership, and that no destination file exists","Clean stale attempt directories under the app's output area, then rerun the job","Force spill and reduce-input files onto one volume by providing a single writable mapreduce.cluster.local.dir for these jobs, or disable uber mode","Verify the AM user has write permission on every local-dir volume"],"exampleFix":"# before: two volumes, spill and reduce-input may split across them\n<property><name>mapreduce.cluster.local.dir</name><value>/disk0/mrlocal,/disk1/mrlocal</value></property>\n# after: single volume for the uberized job\n<property><name>mapreduce.cluster.local.dir</name><value>/disk0/mrlocal</value></property>","handlingStrategy":"try-catch","validationCode":"# verify same-volume placement and clean destination before an uber job\n# (paths appear in the AM log line 'Renaming map output file ...')","typeGuard":null,"tryCatchPattern":"Catch IOException from the rename step, log both source and destination paths, and abort the attempt after cleaning the partial destination; do not blindly retry -- a false-returning raw rename usually means EXDEV, permissions, or an existing destination.","preventionTips":["Keep spill and reduce-input files on a single local-dir volume for uberized jobs","Ensure the AM user owns the attempt output directories","Clean leftover reduce-input slots between reruns"],"tags":["mapreduce","yarn","uber-mode","rename","local-filesystem"],"backgroundTag":"file-rename-failed","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}