apache/beam · error · Error

Unknown DoFn type

Error message

Unknown DoFn type: ${spec}

What it means

The DoFn urn in the transform's spec (spec.doFn.urn) matched none of the JS DoFn urns this operator factory recognizes (JS_DOFN, JS_ASSIGN_TIMESTAMPS, SPLITTING_JS_DOFN, ...). The serialized spec is the input at fault: the runner sent a DoFn flavor the TypeScript worker cannot deserialize.

Solutions

  1. Match SDK versions between the pipeline and the TypeScript worker so all DoFn urns are recognized.
  2. Use only DoFs supported by the JS SDK (plain JS DoFn, assign-timestamps, splitting) in cross-language pipelines.
  3. Register a custom DoFn urn handler in the operator factory if you added a new urn.
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at sdks/typescript/src/apache_beam/worker/operators.ts:964 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/6ff59d7445f3fabb. Report an issue: GitHub.

Appendix: source

Thrown at sdks/typescript/src/apache_beam/worker/operators.ts:964

    } else if (spec.doFn?.urn === urns.JS_ASSIGN_TIMESTAMPS_DOFN_URN) {
      return new AssignTimestampsParDoOperator(
        transformId,
        context.getReceiver(onlyElement(Object.values(transform.outputs))),
        deserializeFn(spec.doFn.payload!).func,
      );
    } else if (spec.doFn?.urn === urns.SPLITTING_JS_DOFN_URN) {
      return new SplittingDoFnOperator(
        transformId,
        Object.fromEntries(
          Object.entries(transform.outputs).map(([tag, pcId]) => [
            tag,
            context.getReceiver(pcId),
          ]),
        ),
        deserializeFn(spec.doFn.payload!),
      );
    } else {
      throw new Error("Unknown DoFn type: " + spec);
    }
  },
);

///

export function encodeToBase64<T>(element: T, coder: Coder<T>): string {
  const writer = new protobufjs.Writer();
  coder.encode(element, writer, CoderContext.wholeStream);
  return Buffer.from(writer.finish()).toString("base64");
}

export function decodeFromBase64<T>(s: string, coder: Coder<T>): T {
  return coder.decode(
    new protobufjs.Reader(Buffer.from(s, "base64")),
    CoderContext.wholeStream,
  );
}

View on GitHub (pinned to 12126d8942)