apache/beam · error · UnsupportedOperationException

Unexpected StandardResolveOptions [%s]

Error message

Unexpected StandardResolveOptions [%s]

What it means

S3ResourceId.resolve only supports StandardResolveOptions.RESOLVE_DIRECTORY and empty options; passing any other option (or an unsupported combination) throws UnsupportedOperationException 'Unexpected StandardResolveOptions [%s]'. Called via resolve/parent/grandParent when navigating S3 resource ids.

Source

Thrown at sdks/java/io/amazon-web-services2/src/main/java/org/apache/beam/sdk/io/aws2/s3/S3ResourceId.java:156

        other += "/";
      }
      if (S3_URI.matcher(other).matches()) {
        return resolveFromUri(other);
      }
      return fromComponents(scheme, bucket, key + other);
    }

    if (resolveOptions == ResolveOptions.StandardResolveOptions.RESOLVE_FILE) {
      checkArgument(
          !other.endsWith("/"), "Cannot resolve a file with a directory path: [%s]", other);
      checkArgument(!"..".equals(other), "Cannot resolve parent as file: [%s]", other);
      if (S3_URI.matcher(other).matches()) {
        return resolveFromUri(other);
      }
      return fromComponents(scheme, bucket, key + other);
    }

    throw new UnsupportedOperationException(
        String.format("Unexpected StandardResolveOptions [%s]", resolveOptions));
  }

  private S3ResourceId resolveFromUri(String uri) {
    S3ResourceId id = fromUri(uri);
    checkArgument(
        id.getScheme().equals(scheme),
        "Cannot resolve a URI as a child resource unless its scheme is [%s]; instead it was [%s]",
        scheme,
        id.getScheme());
    return id;
  }

  @Override
  public ResourceId getCurrentDirectory() {
    if (isDirectory()) {
      return this;
    }

View on GitHub (pinned to 12126d8942)

Solutions

  1. Use only StandardResolveOptions.RESOLVE_DIRECTORY or empty options with S3 resource ids
  2. Remove unsupported resolve options and construct the key directly via fromComponents/getCurrentDirectory
  3. Upgrade Beam if the option you need is newly added and support may have landed later

Example fix

// before
S3ResourceId resolved = id.resolve("child/", StandardResolveOptions.RECURSIVE);
// after
S3ResourceId resolved = id.resolve("child/", StandardResolveOptions.RESOLVE_DIRECTORY);
Defensive patterns

Strategy: type-guard

Validate before calling

if (opts != null && opts != StandardResolveOptions.RESOLVE_DIRECTORY && opts.toString().isEmpty() == false) { /* unsupported for S3 */ }

Type guard

boolean supportedForS3(StandardResolveOptions o) { return o == null || o == StandardResolveOptions.RESOLVE_DIRECTORY; }

Try / catch

try { resolved = id.resolve(path, opts); } catch (UnsupportedOperationException e) { resolved = id.resolve(path, StandardResolveOptions.RESOLVE_DIRECTORY); }

Prevention

When it happens

Trigger: Calling resourceId.resolve(path, StandardResolveOptions.SOMEOPTION) with an option S3ResourceId does not handle; using a new StandardResolveOptions enum value added in Beam but not yet supported by the S3 filesystem.

Common situations: Generic filesystem code that passes resolve options through to a backend that does not implement them; copy-pasted code using options meant for the local/HDFS filesystem.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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