{"record":{"id":"63fda1210ebdf085","repo":"apache/beam","slug":"unsupported-java-version-s","errorCode":null,"errorMessage":"unsupported Java version: %s","messagePattern":"unsupported Java version: (.+?)","errorType":"exception","errorClass":"java.lang.UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/util/construction/Environments.java","lineNumber":171,"sourceCode":"        LOG.warn(\n            \"Java8 support is now deprecated and targeted for removal for Beam 3. Falling back to: {}\",\n            fallback.specification);\n      } else {\n        LOG.warn(\n            \"Unsupported Java version: {}, falling back to: {}\",\n            specification,\n            fallback.specification);\n      }\n      return fallback;\n    }\n\n    public static JavaVersion forSpecificationStrict(String specification) {\n      for (JavaVersion ver : JavaVersion.values()) {\n        if (ver.specification.equals(specification)) {\n          return ver;\n        }\n      }\n      throw new UnsupportedOperationException(\n          String.format(\"unsupported Java version: %s\", specification));\n    }\n  }\n\n  /* For development, use the container build by the current user to ensure that the SDK harness and\n   * the SDK agree on how they should interact. This should be changed to a version-specific\n   * container during a release.\n   *\n   * See https://beam.apache.org/contribute/docker-images/ for more information on how to build a\n   * container.\n   */\n\n  @VisibleForTesting\n  static final String JAVA_SDK_HARNESS_CONTAINER_URL = getDefaultJavaSdkHarnessContainerUrl();\n\n  public static final Environment JAVA_SDK_HARNESS_ENVIRONMENT =\n      createDockerEnvironment(JAVA_SDK_HARNESS_CONTAINER_URL);\n","sourceCodeStart":153,"sourceCodeEnd":189,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/util/construction/Environments.java#L153-L189","documentation":"Environments.JavaVersion.forSpecificationStrict maps a Java specification version string (e.g. \"1.8\", \"11\") to the JavaVersion enum, and throws UnsupportedOperationException when the string matches no known version. It guards that only Java versions Beam has Docker images for are used in portable environments.","triggerScenarios":"Setting PortablePipelineOptions.sdkHarnessContainerImageOptions / java version to a string not in the enum (e.g. \"17\" or \"21\" on an older Beam version, or a misspelled/full version like \"1.8.0_292\").","commonSituations":"Upgrading the JVM to a newer LTS than the Beam release supports; passing a full java.version string instead of the specification; typos in configuration.","solutions":["Use a supported specification string exactly (e.g. \"1.8\", \"11\") matching one of the enum values","Upgrade Apache Beam to a release whose JavaVersion enum includes your version","Build and point to a custom SDK harness container image if you need an unsupported Java version"],"exampleFix":"// before\noptions.setJavaVersion(\"1.8.0_292\");\n// after\noptions.setJavaVersion(\"1.8\"); // or \"11\", a value in Environments.JavaVersion","handlingStrategy":"validation","validationCode":"boolean supported = Arrays.stream(Environments.JavaVersion.values())\n    .anyMatch(v -> v.specification.equals(requestedJavaSpec));\nif (!supported) { /* use a supported spec or upgrade Beam */ }","typeGuard":null,"tryCatchPattern":"try { ver = Environments.JavaVersion.forSpecificationStrict(spec); } catch (UnsupportedOperationException e) { ver = Environments.JavaVersion.JAVA_8; }","preventionTips":["Use exact specification strings like \"1.8\" or \"11\"","Check the Beam release's supported Java versions before upgrading the JVM","Avoid passing full java.version strings"],"tags":["java","apache-beam","environment","unsupported-version"],"backgroundTag":"unsupported-enum-value","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}