apache/beam · error · FileNotFoundException

The requested file doesn't exist.

Error message

The requested file doesn't exist.

What it means

In open(), the filesystem first verifies that the blob container itself exists. If client.getBlobContainerClient(container).exists() returns false, it throws a FileNotFoundException with this message, since nothing under a nonexistent container can be read. This check runs before the individual blob existence check.

Solutions

  1. Verify the container exists with 'az storage container exists --account-name <acct> --name <container>'.
  2. Fix the container name in the azfs:// URI (lowercase, correct spelling).
  3. Confirm the correct storage account is supplied via AzureOptions.setAzureAccessToken/accessKey.
  4. Create the container if it should exist (az storage container create).

Example fix

// before
ReadableByteChannel ch = FileSystems.open(FileSystems.matchNewResource("azfs://mycontainer/MyBlob", true));
// after
// ensure container 'mycontainer' exists in the configured account and blob name is valid
ReadableByteChannel ch = FileSystems.open(FileSystems.matchNewResource("azfs://mycontainer/myblob.txt", true));
Defensive patterns

Strategy: validation

Validate before calling

// verify container before opening
BlobServiceClient svc = new BlobServiceClientBuilder().connectionString(conn).buildClient();
boolean containerExists = svc.getBlobContainerClient(container).exists();
if (!containerExists) throw new IllegalArgumentException("Container missing: " + container);

Try / catch

try {
  return FileSystems.open(resourceId);
} catch (FileNotFoundException e) {
  // container or blob missing: log path, skip or create container
  LOG.warn("azfs resource not found: {}", resourceId);
  return null;
}

Prevention

When it happens

Trigger: Calling FileSystems.open() on an azfs://container/blob path where the container name does not exist in the storage account.

Common situations: Typos in the container segment of the azfs URI; reading from a container that was deleted or created in a different storage account; case-sensitivity mistakes (Azure container names are lowercase); wrong account configured via AzureOptions.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/5774b59722655829. Report an issue: GitHub.

Appendix: source

Thrown at sdks/java/io/azure/src/main/java/org/apache/beam/sdk/io/azure/blobstore/AzureBlobStoreFileSystem.java:299

    if (blobClient.exists()) {
      throw new IOException("This filename is already in use.");
    }

    OutputStream outputStream;
    try {
      outputStream = blobClient.getBlockBlobClient().getBlobOutputStream();
    } catch (BlobStorageException e) {
      throw (IOException) e.getCause();
    }
    return newChannel(outputStream);
  }

  @Override
  protected ReadableByteChannel open(AzfsResourceId resourceId) throws IOException {
    BlobContainerClient containerClient =
        client.get().getBlobContainerClient(resourceId.getContainer());
    if (!containerClient.exists()) {
      throw new FileNotFoundException("The requested file doesn't exist.");
    }
    BlobClient blobClient = containerClient.getBlobClient(resourceId.getBlob());
    if (!blobClient.exists()) {
      throw new FileNotFoundException("The requested file doesn't exist.");
    }
    LOG.info("Creating a ReadableByteChannel for {}", resourceId);
    return new AzureReadableSeekableByteChannel(blobClient);
  }

  @Override
  protected void copy(List<AzfsResourceId> srcPaths, List<AzfsResourceId> destPaths)
      throws IOException {
    checkArgument(
        srcPaths.size() == destPaths.size(),
        "sizes of source paths and destination paths do not match");

    Iterator<AzfsResourceId> sourcePathsIterator = srcPaths.iterator();
    Iterator<AzfsResourceId> destinationPathsIterator = destPaths.iterator();

View on GitHub (pinned to 12126d8942)