{"record":{"id":"1759078fde698c49","repo":"apache/beam","slug":"failed-to-locate-required-method-classname-methodname","errorCode":null,"errorMessage":"Failed to locate required method ${className}.${methodName}","messagePattern":"Failed to locate required method (.+?)\\.(.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/reflect/ByteBuddyDoFnInvokerFactory.java","lineNumber":1047,"sourceCode":"        if (!paramT.isPrimitive()) {\n          pushParameters.add(TypeCasting.to(paramT));\n        }\n      }\n      return new StackManipulation.Compound(pushParameters);\n    }\n  }\n\n  /**\n   * This wrapper exists to convert checked exceptions to unchecked exceptions, since if this fails\n   * the library itself is malformed.\n   */\n  private static MethodDescription getExtraContextFactoryMethodDescription(\n      String methodName, Class<?>... parameterTypes) {\n    try {\n      return new MethodDescription.ForLoadedMethod(\n          DoFnInvoker.ArgumentProvider.class.getMethod(methodName, parameterTypes));\n    } catch (Exception e) {\n      throw new IllegalStateException(\n          String.format(\n              \"Failed to locate required method %s.%s\",\n              DoFnInvoker.ArgumentProvider.class.getSimpleName(), methodName),\n          e);\n    }\n  }\n\n  /**\n   * Calls a zero-parameter getter on the {@link DoFnInvoker.ArgumentProvider}, which must be on top\n   * of the stack.\n   */\n  private static StackManipulation simpleExtraContextParameter(String methodName) {\n    return new StackManipulation.Compound(\n        MethodInvocation.invoke(getExtraContextFactoryMethodDescription(methodName)));\n  }\n\n  static StackManipulation getExtraContextParameter(\n      DoFnSignature.Parameter parameter, final StackManipulation pushDelegate) {","sourceCodeStart":1029,"sourceCodeEnd":1065,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/reflect/ByteBuddyDoFnInvokerFactory.java#L1029-L1065","documentation":"The generated ByteBuddy invoker calls helper methods on DoFnInvoker.ArgumentProvider (pipeline options, state/timer accessors). This IllegalStateException is thrown when a required method cannot be located reflectively, meaning the ArgumentProvider class loaded at runtime does not match what the generated code expects.","triggerScenarios":"getExtraContextFactoryMethodDescription is asked for a method name/parameter types that do not exist on the loaded DoFnInvoker.ArgumentProvider class — typically a Beam SDK version mismatch on the classpath.","commonSituations":"Mixed beam-sdks-java-core versions in a fat/uber jar; shading or relocation that dropped/renamed ArgumentProvider methods; partial SDK upgrade.","solutions":["Ensure a single consistent beam-sdks-java-core version on the classpath (mvn dependency:tree; exclude transitive duplicates).","Rebuild the jar so generated code matches the runtime SDK's ArgumentProvider API.","If shading, relocate the whole org.apache.beam tree consistently or leave the reflect package untouched."],"exampleFix":"// before\n<dependency>beam-sdks-java-core 2.30.0</dependency> <!-- transitive 2.50.0 also present -->\n// after\nmvn dependency:tree -Dincludes=org.apache.beam\n<!-- pin all beam artifacts to one version and add exclusions for stale copies -->","handlingStrategy":"validation","validationCode":"Class<?> ap = DoFnInvoker.ArgumentProvider.class;\nMethod m;\ntry {\n  m = ap.getMethod(\"getPipelineOptions\");\n} catch (NoSuchMethodException e) {\n  throw new IllegalStateException(\"Wrong beam-sdks-java-core version on classpath\", e);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pin one version of all org.apache.beam artifacts; run dependency:tree to catch duplicates.","Do not mix Beam versions in uber jars; exclude transitive beam dependencies of connectors.","When shading Beam, relocate the entire org.apache.beam tree consistently."],"tags":["java","apache-beam","bytebuddy","reflection","classpath"],"backgroundTag":"class-not-found","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}