{"record":{"id":"ddef890d2ce0dd51","repo":"apache/beam","slug":"unexpected-standardresolveoptions-s","errorCode":null,"errorMessage":"Unexpected StandardResolveOptions [%s]","messagePattern":"Unexpected StandardResolveOptions \\[(.+?)\\]","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"sdks/java/io/amazon-web-services2/src/main/java/org/apache/beam/sdk/io/aws2/s3/S3ResourceId.java","lineNumber":156,"sourceCode":"        other += \"/\";\n      }\n      if (S3_URI.matcher(other).matches()) {\n        return resolveFromUri(other);\n      }\n      return fromComponents(scheme, bucket, key + other);\n    }\n\n    if (resolveOptions == ResolveOptions.StandardResolveOptions.RESOLVE_FILE) {\n      checkArgument(\n          !other.endsWith(\"/\"), \"Cannot resolve a file with a directory path: [%s]\", other);\n      checkArgument(!\"..\".equals(other), \"Cannot resolve parent as file: [%s]\", other);\n      if (S3_URI.matcher(other).matches()) {\n        return resolveFromUri(other);\n      }\n      return fromComponents(scheme, bucket, key + other);\n    }\n\n    throw new UnsupportedOperationException(\n        String.format(\"Unexpected StandardResolveOptions [%s]\", resolveOptions));\n  }\n\n  private S3ResourceId resolveFromUri(String uri) {\n    S3ResourceId id = fromUri(uri);\n    checkArgument(\n        id.getScheme().equals(scheme),\n        \"Cannot resolve a URI as a child resource unless its scheme is [%s]; instead it was [%s]\",\n        scheme,\n        id.getScheme());\n    return id;\n  }\n\n  @Override\n  public ResourceId getCurrentDirectory() {\n    if (isDirectory()) {\n      return this;\n    }","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/io/amazon-web-services2/src/main/java/org/apache/beam/sdk/io/aws2/s3/S3ResourceId.java#L138-L174","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Use only StandardResolveOptions.RESOLVE_DIRECTORY or empty options with S3 resource ids","Remove unsupported resolve options and construct the key directly via fromComponents/getCurrentDirectory","Upgrade Beam if the option you need is newly added and support may have landed later"],"exampleFix":"// before\nS3ResourceId resolved = id.resolve(\"child/\", StandardResolveOptions.RECURSIVE);\n// after\nS3ResourceId resolved = id.resolve(\"child/\", StandardResolveOptions.RESOLVE_DIRECTORY);","handlingStrategy":"type-guard","validationCode":"if (opts != null && opts != StandardResolveOptions.RESOLVE_DIRECTORY && opts.toString().isEmpty() == false) { /* unsupported for S3 */ }","typeGuard":"boolean supportedForS3(StandardResolveOptions o) { return o == null || o == StandardResolveOptions.RESOLVE_DIRECTORY; }","tryCatchPattern":"try { resolved = id.resolve(path, opts); } catch (UnsupportedOperationException e) { resolved = id.resolve(path, StandardResolveOptions.RESOLVE_DIRECTORY); }","preventionTips":["Only use RESOLVE_DIRECTORY (or default) resolve options with S3 resource ids","Do not pass resolve options designed for local/HDFS filesystems to S3 paths"],"tags":["java","s3","unsupported-operation"],"backgroundTag":"unsupported-operation","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-15T02:17:10.978Z"}