{"record":{"id":"fe9bb0b89d484edf","repo":"apache/hadoop","slug":"53","errorCode":"53","errorMessage":"Wrong filesystem for URI \" + fs.getUri() + \" : \" + fs.getClass().getName()","messagePattern":"Wrong filesystem for URI \" \\+ fs\\.getUri\\(\\) \\+ \" : \" \\+ fs\\.getClass\\(\\)\\.getName\\(\\)","errorType":"exception","errorClass":"ExitUtil.ExitException","httpStatus":null,"severity":"error","filePath":"hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/s3guard/S3GuardTool.java","lineNumber":288,"sourceCode":"  protected S3AFileSystem getFilesystem() {\n    return filesystem;\n  }\n\n  /**\n   * Sets the filesystem; it must be an S3A FS instance, or a FilterFS\n   * around an S3A Filesystem.\n   * @param bindingFS filesystem to bind to\n   * @return the bound FS.\n   * @throws ExitUtil.ExitException if the FS is not an S3 FS\n   */\n  protected S3AFileSystem bindFilesystem(FileSystem bindingFS) {\n    FileSystem fs = bindingFS;\n    baseFS = bindingFS;\n    while (fs instanceof FilterFileSystem) {\n      fs = ((FilterFileSystem) fs).getRawFileSystem();\n    }\n    if (!(fs instanceof S3AFileSystem)) {\n      throw new ExitUtil.ExitException(EXIT_SERVICE_UNAVAILABLE,\n          WRONG_FILESYSTEM + \"URI \" + fs.getUri() + \" : \"\n              + fs.getClass().getName());\n    }\n    filesystem = (S3AFileSystem) fs;\n    return filesystem;\n  }\n\n  /**\n   * Reset the store and filesystem bindings.\n   */\n  protected void resetBindings() {\n    filesystem = null;\n  }\n\n  protected final CommandFormat getCommandFormat() {\n    return commandFormat;\n  }\n","sourceCodeStart":270,"sourceCodeEnd":306,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/s3guard/S3GuardTool.java#L270-L306","documentation":"S3GuardTool commands resolve the target filesystem and bindFilesystem() unwraps FilterFileSystems; if the result is not an S3AFileSystem it exits with ExitUtil.ExitException code EXIT_SERVICE_UNAVAILABLE (53) and message 'Wrong filesystem for URI <uri> : <fs class>'. The s3guard CLI only operates on s3a:// destinations, so the invocation resolved a different filesystem implementation.","triggerScenarios":"Running 'hadoop s3guard <command>' without an explicit s3a:// URI so fs.defaultFS (e.g. hdfs:// or file:///) resolves the path; passing -fs file:/// or an s3n:// URL (which binds the legacy S3 filesystem, not S3A); using a filtered filesystem (e.g. through Router-based/ViewFS layers) whose raw FS is not S3A.","commonSituations":"Running the CLI on a node whose core-site.xml default FS is the local filesystem or HDFS; legacy scripts using s3n:// or s3:// buckets; embedded invocation of S3GuardTool from tooling that passes a generic FileSystem. On 3.4+ most s3guard commands are gone anyway since S3Guard was removed.","solutions":["Pass an explicit s3a:// URI: hadoop s3guard <cmd> s3a://bucket/path or -fs s3a://bucket.","Replace s3n:// and s3:// schemes with s3a:// in scripts and configs.","Check fs.defaultFS / the command's -fs argument to see which filesystem actually got bound.","On Hadoop 3.4+, drop S3Guard tool usage entirely (feature removed) and remove the corresponding commands from runbooks."],"exampleFix":"# before: default FS is hdfs:// -> exit code 53\nhadoop s3guard destroyed -fs /\n\n# after: explicit S3A URI (and on 3.4+, remove s3guard usage)\nhadoop s3guard <command> s3a://my-bucket/","handlingStrategy":"validation","validationCode":"Path p = new Path(args[0]);\nif (!\"s3a\".equals(p.toUri().getScheme())) {\n  throw new IllegalArgumentException(\n      \"S3GuardTool requires an s3a:// URI, got: \" + p);\n}","typeGuard":null,"tryCatchPattern":"try {\n  tool.run(args);\n} catch (ExitUtil.ExitException e) {\n  if (e.getExitCode() == 53) { // EXIT_SERVICE_UNAVAILABLE\n    // rerun with an explicit s3a://bucket URI\n  } else { throw e; }\n}","preventionTips":["Always pass explicit s3a://bucket/path URIs to S3A-only tools.","Migrate scripts off s3n:// and s3:// schemes to s3a://.","On Hadoop 3.4+ remove s3guard CLI usage entirely (feature removed)."],"tags":["hadoop-aws","s3guard","cli","filesystem-scheme","exit-code-53"],"backgroundTag":"wrong-filesystem-scheme","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}