apache/beam · error · RuntimeException

Failed to locate ProcessContinuation.stop()

Error message

Failed to locate ProcessContinuation.stop()

What it means

A static initializer caches a MethodDescription for DoFn.ProcessContinuation.stop(), which exists in every valid Beam SDK version. If reflection cannot find stop(), the class throws this RuntimeException, indicating a corrupt or foreign ProcessContinuation class is on the classpath.

Source

Thrown at sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/reflect/ByteBuddyDoFnInvokerFactory.java:1372

                TypeCasting.to(new TypeDescription.ForLoadedType(p.keyT().getRawType())));
          }
        });
  }

  /**
   * Implements the invoker's {@link DoFnInvoker#invokeProcessElement} method by delegating to the
   * {@link ProcessElement} method.
   */
  private static final class ProcessElementDelegation
      extends DoFnMethodWithExtraParametersDelegation {
    private static final MethodDescription PROCESS_CONTINUATION_STOP_METHOD;

    static {
      try {
        PROCESS_CONTINUATION_STOP_METHOD =
            new MethodDescription.ForLoadedMethod(DoFn.ProcessContinuation.class.getMethod("stop"));
      } catch (NoSuchMethodException e) {
        throw new RuntimeException("Failed to locate ProcessContinuation.stop()");
      }
    }

    /** Implementation of {@link MethodDelegation} for the {@link ProcessElement} method. */
    private ProcessElementDelegation(
        TypeDescription doFnType, DoFnSignature.ProcessElementMethod signature) {
      super(doFnType, signature);
    }

    @Override
    protected StackManipulation afterDelegation(MethodDescription instrumentedMethod) {
      if (TypeDescription.VOID.equals(targetMethod.getReturnType().asErasure())) {
        return new StackManipulation.Compound(
            MethodInvocation.invoke(PROCESS_CONTINUATION_STOP_METHOD), MethodReturn.REFERENCE);
      } else {
        return MethodReturn.of(targetMethod.getReturnType().asErasure());
      }
    }

View on GitHub (pinned to 12126d8942)

Solutions

  1. Ensure the real org.apache.beam.sdk.transforms.DoFn$ProcessContinuation from a consistent SDK version is loaded; remove shadowing jars.
  2. Rebuild dependencies so all Beam artifacts share one version.
  3. Locate the loaded class with -verbose:class (or getCodeSource()) and delete the bad copy.

Example fix

// before
// fat jar contains old beam-core whose ProcessContinuation lacks stop()
// after
mvn dependency:tree -Dincludes=org.apache.beam # pin all beam artifacts to one version and exclude stale copies
Defensive patterns

Strategy: validation

Validate before calling

try {
  DoFn.ProcessContinuation.class.getMethod("stop");
} catch (NoSuchMethodException e) {
  throw new IllegalStateException("Incompatible org.apache.beam DoFn class on classpath", e);
}

Prevention

When it happens

Trigger: Class initialization runs ProcessContinuation.class.getMethod("stop") and receives NoSuchMethodException — only possible if the loaded ProcessContinuation class lacks that method.

Common situations: Shaded/relocated Beam classes mixed with an incompatible SDK version; a stubbed ProcessContinuation shadowing the real one; broken partial upgrade of beam-sdks-java-core.

Related errors


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