{"record":{"id":"d252551adea88c4f","repo":"apache/beam","slug":"unable-to-bind-invoker-for-fnclass","errorCode":null,"errorMessage":"Unable to bind invoker for ${fnClass}","messagePattern":"Unable to bind invoker for (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/reflect/ByteBuddyDoFnInvokerFactory.java","lineNumber":381,"sourceCode":"              onTimerMethod.id(), OnTimerInvokers.forTimer(fn, onTimerMethod.id()));\n        }\n      }\n\n      if (signature.onTimerFamilyMethods() != null) {\n        for (DoFnSignature.OnTimerFamilyMethod onTimerFamilyMethod :\n            signature.onTimerFamilyMethods().values()) {\n          invoker.addOnTimerFamilyInvoker(\n              onTimerFamilyMethod.id(),\n              OnTimerInvokers.forTimerFamily(fn, onTimerFamilyMethod.id()));\n        }\n      }\n      return invoker;\n    } catch (InstantiationException\n        | IllegalAccessException\n        | IllegalArgumentException\n        | InvocationTargetException\n        | SecurityException e) {\n      throw new RuntimeException(\"Unable to bind invoker for \" + fn.getClass(), e);\n    }\n  }\n\n  private <InputT, OutputT> Constructor<?> getByteBuddyInvokerConstructor(\n      DoFnSignature signature, DoFn<InputT, OutputT> fn) {\n    // Extract input and output type descriptors to distinguish generic instantiations.\n    // Fall back to Object.class if unavailable. When type info is lost, different generic\n    // instantiations share an invoker, which is acceptable since the DoFn class in the cache\n    // key prevents collisions between different DoFn classes.\n    TypeDescriptor<InputT> inputType;\n    try {\n      inputType = fn.getInputTypeDescriptor();\n    } catch (Exception e) {\n      // Some DoFns (like MapElements) throw IllegalStateException if queried after\n      // serialization.\n      // In this case, we fall back to the raw class behavior (Object).\n      inputType = null;\n    }","sourceCodeStart":363,"sourceCodeEnd":399,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/reflect/ByteBuddyDoFnInvokerFactory.java#L363-L399","documentation":"When creating a DoFn invoker, ByteBuddy generates an invoker class and instantiates it reflectively with the DoFn instance. If that instantiation throws (bad access, wrong arguments, security manager, reflective target failure), it is wrapped in this RuntimeException naming the DoFn class.","triggerScenarios":"newByteBuddyInvoker fails while invoking the generated invoker's constructor — generated class inaccessible to the classloader, reflection blocked, or the constructor rejected the argument.","commonSituations":"Java 9+ JPMS strong encapsulation without --add-opens; SecurityManager or container classloader isolation (OSGi, app servers); outdated ByteBuddy on a newer JDK.","solutions":["Add JVM flags --add-opens java.base/java.lang=ALL-UNNAMED (and related packages) or use a JDK supported by your Beam/ByteBuddy versions.","Inspect the chained cause for the real error (access vs security vs instantiation) and fix that specifically.","Avoid custom classloaders that cannot see the generated invoker classes; run on the same classloader that built the pipeline.","Upgrade beam-sdks-java-core / byte-buddy to versions compatible with your platform."],"exampleFix":"// before\njava -jar app.jar // RuntimeException wrapping InstantiationException on Java 17\n// after\njava --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED -jar app.jar","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  DoFnInvoker invoker = ByteBuddyDoFnInvokerFactory.newByteBuddyInvoker(fn);\n} catch (RuntimeException e) {\n  LOG.error(\"Failed to bind invoker for \" + fn.getClass(), e.getCause());\n  throw e;\n}","preventionTips":["Run on a JDK supported by your Beam/ByteBuddy version; add --add-opens flags on Java 9+.","Avoid SecurityManager or classloader-isolated containers for workers.","Keep beam-sdks-java-core and byte-buddy versions aligned."],"tags":["java","apache-beam","bytebuddy","reflection","classloading"],"backgroundTag":"module-init-failed","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"}