{"record":{"id":"a7e46b97bc3096aa","repo":"apache/beam","slug":"the-specified-bucket-does-not-exist-gs-s","errorCode":null,"errorMessage":"The specified bucket does not exist: gs://%s","messagePattern":"The specified bucket does not exist: gs://(.+?)","errorType":"exception","errorClass":"FileNotFoundException","httpStatus":null,"severity":"error","filePath":"sdks/java/extensions/google-cloud-platform-core/src/main/java/org/apache/beam/sdk/extensions/gcp/util/GcsUtilV2.java","lineNumber":440,"sourceCode":"    rewriteHelper(srcPaths, dstPaths, false, MissingStrategy.FAIL_IF_MISSING, strategy);\n  }\n\n  public void move(\n      Iterable<GcsPath> srcPaths,\n      Iterable<GcsPath> dstPaths,\n      MissingStrategy srcMissing,\n      OverwriteStrategy dstOverwrite)\n      throws IOException {\n    rewriteHelper(srcPaths, dstPaths, true, srcMissing, dstOverwrite);\n  }\n\n  /** Get the {@link Bucket} from Cloud Storage path or propagates an exception. */\n  public Bucket getBucket(GcsPath path, BucketGetOption... options) throws IOException {\n    String bucketName = path.getBucket();\n    try {\n      Bucket bucket = storage.get(bucketName, options);\n      if (bucket == null) {\n        throw new FileNotFoundException(\n            String.format(\"The specified bucket does not exist: gs://%s\", bucketName));\n      }\n      return bucket;\n    } catch (StorageException e) {\n      throw translateStorageException(bucketName, null, e);\n    }\n  }\n\n  /** Returns whether the GCS bucket exists and is accessible. */\n  public boolean bucketAccessible(GcsPath path) {\n    try {\n      // Fetch only the name field to minimize data transfer\n      getBucket(path, BucketGetOption.fields(BucketField.NAME));\n      return true;\n    } catch (IOException e) {\n      return false;\n    }\n  }","sourceCodeStart":422,"sourceCodeEnd":458,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/extensions/google-cloud-platform-core/src/main/java/org/apache/beam/sdk/extensions/gcp/util/GcsUtilV2.java#L422-L458","documentation":"GcsUtilV2.getBucket fetches a Bucket via the Storage client and throws FileNotFoundException when Storage.get(bucketName) returns null, meaning the bucket does not exist (or is invisible to the credentials). StorageExceptions are translated separately.","triggerScenarios":"Any call path through getBucket — bucketAccessible, verifyBucketAccessible, or bucket(path) — where the bucket name doesn't exist or the caller has no permission to see it (a 403 can surface as null in some configurations).","commonSituations":"Typo in the --gcsEndpoint / staging bucket / tempLocation bucket name; using a bucket in a different project than the credential; bucket deleted or renamed between job submission and execution; regional bucket name mismatches.","solutions":["Verify the bucket: gsutil ls gs://<bucket> or check the Cloud Console.","Confirm the bucket name in pipeline options (tempLocation, stagingLocation) is exact and lowercase.","Ensure the credential's project can access the bucket; grant roles/storage.admin or objectViewer on it.","Create the bucket if it was never provisioned (gsutil mb)."],"exampleFix":"// before\noptions.setTempLocation(\"gs://my-temp-bucket/path\"); // typo'd bucket\n// after: validate early\nnew GcsOptionsValidator()/* or */; // gcloud storage buckets describe gs://my-temp-bucket\noptions.setTempLocation(\"gs://correct-temp-bucket/path\");","handlingStrategy":"validation","validationCode":"// fail fast at job setup\nString bucket = GcsPath.fromUri(options.getTempLocation()).getBucket();\nif (!gcsUtil.bucketAccessible(bucket)) {\n  throw new IllegalArgumentException(\"Bucket missing or inaccessible: \" + bucket);\n}","typeGuard":null,"tryCatchPattern":"try {\n  Bucket b = gcsUtil.getBucket(path);\n} catch (FileNotFoundException e) {\n  // create the bucket or correct the configured location before proceeding\n}","preventionTips":["Validate tempLocation/stagingLocation buckets during option validation","Keep bucket names in one config source, verified with gsutil ls","Ensure the credential's project matches the bucket's project"],"tags":["gcs","bucket-not-found","config","java","apache-beam"],"backgroundTag":"resource-not-found","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}