{"record":{"id":"acb12e17ae51409d","repo":"apache/hadoop","slug":"file-deletion-is-not-supported-in-pseudo-local-fil","errorCode":null,"errorMessage":"File deletion is not supported in pseudo local file system.","messagePattern":"File deletion 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":323,"sourceCode":"    throw new UnsupportedOperationException(\"Append is not supported\"\n        + \" in pseudo local file system.\");\n  }\n\n  @Override\n  public boolean mkdirs(Path f, FsPermission permission) throws IOException {\n    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":305,"sourceCodeEnd":339,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-tools/hadoop-gridmix/src/main/java/org/apache/hadoop/mapred/gridmix/PseudoLocalFs.java#L305-L339","documentation":"PseudoLocalFs.delete() unconditionally throws UnsupportedOperationException. Since pseudo-local files are never materialized on disk (data is synthesized from the file name on each open), there is nothing to delete. Note the method signature does not even declare IOException — the UnsupportedOperationException is unchecked.","triggerScenarios":"Calling FileSystem.delete(Path, boolean) on PseudoLocalFs; job-cleanup and task-abort paths that delete temporary/output directories; DistributedCache cleanup hooks run against pseudo-local distributed-cache files.","commonSituations":"Gridmix's DistributedCacheEmulator creates pseudo-local files; if a job or cleanup task later tries to delete them, this throws. Also common when generic test teardown or workspace-cleanup code deletes everything under a root that includes pseudo:// URIs.","solutions":["Exclude pseudo:/// paths from cleanup/teardown logic (skip when scheme is 'pseudo')","Let unused pseudo-local files simply be forgotten — they consume no storage","If cleanup must succeed, catch UnsupportedOperationException (unchecked) around delete for pseudo files, or route deletion to a real FileSystem only for real paths"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Skip deletion for virtual file systems\nstatic void safeDelete(FileSystem fs, Path p) throws IOException {\n  if (\"pseudo\".equals(fs.getUri().getScheme())) {\n    return; // pseudo-local files are generated on read; nothing to delete\n  }\n  fs.delete(p, true);\n}","typeGuard":null,"tryCatchPattern":"try {\n  fs.delete(path, true);\n} catch (UnsupportedOperationException e) {\n  // unchecked; pseudo-local files need no cleanup\n}","preventionTips":["Exclude pseudo:// from cleanup loops by scheme","Remember pseudo-local files consume no storage — skipping delete is safe"],"tags":["hadoop","gridmix","pseudo-local-fs","unsupported-operation","delete"],"backgroundTag":"unsupported-operation","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}