{"record":{"id":"198eed1517985cff","repo":"apache/hadoop","slug":"42-198eed","errorCode":"42","errorMessage":"Filesystem is not S3A URL: {fsURI}","messagePattern":"Filesystem is not S3A URL: (.+?)","errorType":"error_code","errorClass":"ExitUtil.ExitException","httpStatus":null,"severity":"error","filePath":"hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/tools/BucketTool.java","lineNumber":179,"sourceCode":"    LOG.debug(\"Supplied arguments: {}\", String.join(\", \", args));\n    final List<String> parsedArgs = parseArgsWithErrorReporting(args);\n\n    CommandFormat command = getCommandFormat();\n    boolean create = command.getOpt(CREATE);\n\n    Optional<String> endpoint = getOptionalString(OPT_ENDPOINT);\n    Optional<String> region = getOptionalString(OPT_REGION);\n    Optional<String> zone = getOptionalString(OPT_ZONE);\n\n\n    final String bucketPath = parsedArgs.get(0);\n    final Path source = new Path(bucketPath);\n    URI fsURI = source.toUri();\n    String bucket = fsURI.getHost();\n\n    println(out, \"Filesystem %s\", fsURI);\n    if (!\"s3a\".equals(fsURI.getScheme())) {\n      throw new ExitUtil.ExitException(EXIT_USAGE, \"Filesystem is not S3A URL: \" + fsURI);\n    }\n    println(out, \"Options region=%s endpoint=%s zone=%s s3a://%s\",\n        region.orElse(\"(unset)\"),\n        endpoint.orElse(\"(unset)\"),\n        zone.orElse(\"(unset)\"),\n        bucket);\n    if (!create) {\n      errorln(getUsage());\n      println(out, \"Supplied arguments: [\"\n          + String.join(\", \", parsedArgs)\n          + \"]\");\n      throw new ExitUtil.ExitException(EXIT_USAGE,\n          \"required option not found: -create\");\n    }\n\n    final Configuration conf = getConf();\n\n    removeBucketOverrides(bucket, conf,","sourceCodeStart":161,"sourceCodeEnd":197,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/tools/BucketTool.java#L161-L197","documentation":"The 'bucket' subcommand treats its single non-option argument as the URL of the bucket to create: it builds a Path, takes its URI and uses the host as the bucket name. If the URI scheme is not exactly 's3a', it exits with code 42 (EXIT_USAGE) and 'Filesystem is not S3A URL: <uri>'.","triggerScenarios":"Passing 's3://bucket' (AWS CLI habit), a bare 'bucketname' (URI with null scheme and null host), 'wasb://...' or another scheme, or a local path like '/tmp/x'; any of these fails the 's3a'.equals(scheme) check.","commonSituations":"Muscle memory from the AWS CLI ('aws s3 ...' uses s3://); scripts that pass just the bucket name; operators mixing HDFS or ABFS URLs into an S3 tool invocation.","solutions":["Pass the fully qualified URL with the s3a scheme: 'hadoop aws s3guard bucket -create s3a://my-bucket'","If your script holds a bare bucket name, prefix it: \"s3a://$BUCKET\"","Do not substitute s3:// for s3a:// - the S3A connector only recognizes its own scheme"],"exampleFix":"# before\nhadoop aws s3guard bucket -create s3://my-bucket\n# after\nhadoop aws s3guard bucket -create s3a://my-bucket","handlingStrategy":"validation","validationCode":"URI u = new Path(bucketArg).toUri();\nif (!\"s3a\".equals(u.getScheme()) || u.getHost() == null) {\n  throw new IllegalArgumentException(\"bucket tool requires s3a://bucket URL, got: \" + bucketArg);\n}","typeGuard":null,"tryCatchPattern":"try {\n  int rc = new BucketTool(conf).exec(args);\n} catch (ExitUtil.ExitException e) {\n  if (e.getExitCode() == 42 && e.getMessage().contains(\"not S3A URL\")) {\n    // rewrite the argument to s3a:// form and retry once\n  }\n}","preventionTips":["Normalize bucket arguments to s3a://bucket at the wrapper boundary","Beware AWS CLI muscle memory: s3:// is never accepted by S3A tooling"],"tags":["cli","usage","s3a","uri-scheme","bucket","exit-code-42"],"backgroundTag":"wrong-filesystem-scheme","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}