apache/hadoop · critical · FileNotFoundException

Bucket {} does not exist

Error message

Bucket {} does not exist

What it means

OBSCommonUtils.verifyBucketExists calls headBucket(bucket) during OBSFileSystem.initialize; a definitive false (bucket really absent) throws FileNotFoundException('Bucket <bucket> does not exist'). Transient ObsException failures are retried up to MAX_RETRY_TIME with warnings; only after exhausting retries (or a clean false) does initialization fail. A clean false means name/endpoint/credentials pointed at a place where that bucket name is not visible — not necessarily that the bucket is gone.

Source

Thrown at hadoop-cloud-storage-project/hadoop-huaweicloud/src/main/java/org/apache/hadoop/fs/obs/OBSCommonUtils.java:1445

          + OBSConstants.OBS_SECURITY_CREDENTIAL_PROVIDER_PATH);
    }
  }

  /**
   * Verify that the bucket exists. This does not check permissions, not even
   * read access.
   *
   * @param owner the owner OBSFileSystem instance
   * @throws FileNotFoundException the bucket is absent
   * @throws IOException           any other problem talking to OBS
   */
  static void verifyBucketExists(final OBSFileSystem owner)
      throws FileNotFoundException, IOException {
    int retryTime = 1;
    while (true) {
      try {
        if (!owner.getObsClient().headBucket(owner.getBucket())) {
          throw new FileNotFoundException(
              "Bucket " + owner.getBucket() + " does not exist");
        }
        return;
      } catch (ObsException e) {
        LOG.warn("Failed to head bucket for [{}], retry time [{}], "
                + "exception [{}]", owner.getBucket(), retryTime,
            translateException("doesBucketExist", owner.getBucket(),
                e));

        if (MAX_RETRY_TIME == retryTime) {
          throw translateException("doesBucketExist",
              owner.getBucket(), e);
        }

        try {
          Thread.sleep(DELAY_TIME);
        } catch (InterruptedException ie) {
          throw e;

View on GitHub (pinned to 2add963021)

Solutions

  1. Verify the exact bucket name and that it exists in the SAME region as fs.obs.endpoint (check with the OBS console or obsutil ls).
  2. Fix fs.obs.endpoint to the region-correct endpoint (e.g. obs.cn-north-4.myhuaweicloud.com vs eu-west-101), then re-initialize.
  3. Confirm the AK/SK owner has access to that bucket in that region (tenant/project alignment for temporary credentials).
  4. If the bucket truly must be new, create it (console, obsutil, or a one-off bootstrap job) before starting the cluster/job.

Example fix

# before (core-site.xml)
<property><name>fs.obs.endpoint</name><value>obs.cn-north-4.myhuaweicloud.com</value></property>
# bucket actually lives in eu-west-101 -> Bucket X does not exist

# after
<property><name>fs.obs.endpoint</name><value>obs.eu-west-101.myhuaweicloud.com</value></property>
# verify: obsutil ls -bucket=my-bucket -e=obs.eu-west-101.myhuaweicloud.com
Defensive patterns

Strategy: validation

Validate before calling

static void verifyBucketReachable(String bucket, String endpoint, String ak, String sk) {
  ObsConfiguration c = new ObsConfiguration();
  c.setEndPoint(endpoint);
  try (ObsClient client = new ObsClient(ak, sk, c)) {
    if (!client.headBucket(bucket)) {
      throw new IllegalArgumentException("bucket " + bucket + " not visible at " + endpoint);
    }
  } catch (ObsException e) {
    throw new IllegalArgumentException("cannot reach OBS at " + endpoint + ": " + e.getMessage(), e);
  }
}

Try / catch

try {
  fs.initialize(obsUri, conf);
} catch (FileNotFoundException e) {
  if (String.valueOf(e.getMessage()).endsWith("does not exist")) {
    throw new ConfigException("bucket/endpoint mismatch — verify fs.obs.endpoint region and bucket name", e);
  }
  throw e;
}

Prevention

When it happens

Trigger: Initializing obs://bucket/ with a typo'd bucket name; wrong fs.obs.endpoint (different region or wrong service domain) so the bucket is invisible to that endpoint; AK/SK belonging to a different tenant/region that cannot see the bucket; bucket genuinely deleted; endpoint reachable only via proxy that is misconfigured (those surface as ObsException retries first).

Common situations: Cross-region endpoints after bucket migration; new clusters cloned from configs pointing at old endpoints; typos in bucket ARN-style names ('obs://my-buket'); IAM user scoped to another project; test configs promoted to prod with placeholder bucket names.

Related errors


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/7b806d2dd7688678. Report an issue: GitHub.