{"record":{"id":"20b5d9d7a16d0634","repo":"apache/hadoop","slug":"setworkingdirectory-is-not-supported-in-pseudo-loc","errorCode":null,"errorMessage":"SetWorkingDirectory is not supported in pseudo local file system.","messagePattern":"SetWorkingDirectory is not supported in pseudo local file system\\.","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"hadoop-tools/hadoop-gridmix/src/main/java/org/apache/hadoop/mapred/gridmix/PseudoLocalFs.java","lineNumber":329,"sourceCode":"    throw new UnsupportedOperationException(\"Mkdirs is not supported\"\n        + \" in pseudo local file system.\");\n  }\n\n  @Override\n  public boolean rename(Path src, Path dst) throws IOException {\n    throw new UnsupportedOperationException(\"Rename is not supported\"\n        + \" in pseudo local file system.\");\n  }\n\n  @Override\n  public boolean delete(Path path, boolean recursive) {\n    throw new UnsupportedOperationException(\"File deletion is not supported \"\n        + \"in pseudo local file system.\");\n  }\n\n  @Override\n  public void setWorkingDirectory(Path newDir) {\n    throw new UnsupportedOperationException(\"SetWorkingDirectory \"\n        + \"is not supported in pseudo local file system.\");\n  }\n\n  @Override\n  public Path makeQualified(Path path) {\n    // skip FileSystem#checkPath() to validate some other Filesystems\n    return path.makeQualified(this.getUri(), this.getWorkingDirectory());\n  }\n}\n","sourceCodeStart":311,"sourceCodeEnd":339,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-tools/hadoop-gridmix/src/main/java/org/apache/hadoop/mapred/gridmix/PseudoLocalFs.java#L311-L339","documentation":"PseudoLocalFs.setWorkingDirectory() unconditionally throws UnsupportedOperationException. The file system has a single fixed home/working directory ('/' by default, or the Path passed to the constructor) and no directory hierarchy, so changing the working directory cannot be meaningful. getWorkingDirectory() and getHomeDirectory() always return that fixed root.","triggerScenarios":"Calling FileSystem.setWorkingDirectory(Path) on a PseudoLocalFs instance; frameworks that set the working directory per task or per operation (many InputFormats and commit protocols do this) when the default FileSystem is pseudo:///","commonSituations":"Setting fs.defaultFS or a job's working directory to pseudo:/// so that PseudoLocalFs becomes the default FileSystem, which makes generic Hadoop code call setWorkingDirectory on it; harnesses that call setWorkingDirectory defensively at task start.","solutions":["Do not make PseudoLocalFs the default FileSystem; reference pseudo-local files by fully-qualified pseudo:/// URIs while the default FS remains a real one","Skip setWorkingDirectory when fs.getUri().getScheme().equals(\"pseudo\")","If a custom home is needed, construct PseudoLocalFs with the desired home Path (constructor argument) instead of mutating it later"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if (!\"pseudo\".equals(fs.getUri().getScheme())) {\n  fs.setWorkingDirectory(dir);\n}","typeGuard":null,"tryCatchPattern":"try {\n  fs.setWorkingDirectory(newDir);\n} catch (UnsupportedOperationException e) {\n  // pseudo FS has a fixed working dir; proceed with fully-qualified paths\n}","preventionTips":["Do not set fs.defaultFS to pseudo:/// in gridmix jobs","Use fully-qualified pseudo:/// URIs so no component needs a working directory"],"tags":["hadoop","gridmix","pseudo-local-fs","unsupported-operation","working-directory"],"backgroundTag":"unsupported-operation","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}