apache/beam · error · Error

not defined outside of a process() call.

Error message

${param.parDoParamName} not defined outside of a process() call.

What it means

DoFnProcessContext.lookup was called while the context has no current windowed value (this.wvalue is null), i.e. a side-input/state parameter accessor was invoked outside of an active process() invocation for an element. The param named by parDoParamName is the input at fault; the guard exists because side inputs can only be resolved against the current element's window.

Solutions

  1. Move the accessor call (e.g. sideInput()/state lookups) inside the DoFn's process method so a current element/window exists.
  2. Use a startBundle/finishBundle-safe API for context-free data instead of per-element parameters.
  3. Never cache the context object and reuse it across elements; re-read params from the process argument each call.
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at sdks/typescript/src/apache_beam/worker/pardo_context.ts:157 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at sdks/typescript/src/apache_beam/worker/pardo_context.ts:157

    if (wvalue === null || wvalue === undefined) {
      return operators.NonPromise;
    }
    // We have to prefetch all the side inputs.
    // TODO: (API) Let the user's process() await them.
    if (this.prefetchCallbacks.length === 0) {
      return operators.NonPromise;
    } else {
      const result = new operators.ProcessResultBuilder();
      for (const cb of this.prefetchCallbacks) {
        result.add(cb(wvalue!.windows[0]));
      }
      return result.build();
    }
  }

  lookup(param) {
    if (this.wvalue === null || this.wvalue === undefined) {
      throw new Error(
        param.parDoParamName + " not defined outside of a process() call.",
      );
    }

    switch (param.parDoParamName) {
      case "window":
        // If we're here and there was more than one window, we have exploded.
        return this.wvalue.windows[0];

      case "timestamp":
        return this.wvalue.timestamp;

      case "paneinfo":
        return this.wvalue.pane;

      case "sideInput":
        return this.sideInputValues.get(param.sideInputId) as any;

View on GitHub (pinned to 12126d8942)