apache/beam · error · UnsupportedOperationException

FireTimestamp unsupported in %s

Error message

FireTimestamp unsupported in %s

What it means

DoFnInvoker's UnsupportedInvocationBehavior throws this when a DoFn callback calls fireTimestamp() where the invocation context does not support it. Fire timestamps are available for @OnTimer and certain windowing contexts, not for arbitrary bundle/element processing callbacks; the default behavior refuses to fabricate a timestamp. The formatted context identifies the offending DoFn and callback.

Source

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

      throw new UnsupportedOperationException(
          String.format("RecordId unsupported in %s", getErrorContext()));
    }

    @Override
    public @Nullable Long currentRecordOffset(DoFn<InputT, OutputT> doFn) {
      throw new UnsupportedOperationException(
          String.format("RecordOffset unsupported in %s", getErrorContext()));
    }

    @Override
    public Instant fireTimestamp(DoFn<InputT, OutputT> doFn) {
      throw new UnsupportedOperationException(
          String.format("FireTimestamp unsupported in %s", getErrorContext()));
    }

    @Override
    public CausedByDrain causedByDrain(DoFn<InputT, OutputT> doFn) {
      throw new UnsupportedOperationException(
          String.format("CausedByDrain unsupported in %s", getErrorContext()));
    }

    @Override
    public ValueKind valueKind(DoFn<InputT, OutputT> doFn) {
      throw new UnsupportedOperationException(
          String.format("ValueKind unsupported in %s", getErrorContext()));
    }

    @Override
    public String timerId(DoFn<InputT, OutputT> doFn) {
      throw new UnsupportedOperationException(
          String.format("TimerId unsupported in %s", getErrorContext()));
    }

    @Override
    public TimeDomain timeDomain(DoFn<InputT, OutputT> doFn) {
      throw new UnsupportedOperationException(

View on GitHub (pinned to 12126d8942)

Solutions

  1. Call fireTimestamp() only from @OnTimer (or other supported) callbacks; move the logic there
  2. Use context.timestamp() on the element in @ProcessElement if you meant the element's event timestamp instead of a timer fire time
  3. Test with TestPipeline or a runner-backed harness rather than DoFnInvokers.invokerFor(...) directly
  4. Guard with try-catch for UnsupportedOperationException if the timestamp is optional in your pipeline

Example fix

// before
@ProcessElement
public void process(ProcessContext c) {
  Instant t = c.fireTimestamp();
}
// after
@ProcessElement
public void process(ProcessContext c) {
  Instant t = c.timestamp();
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Call fireTimestamp() only from @OnTimer callbacks; verify callback type before use:
// in @ProcessElement use context.timestamp(); reserve fireTimestamp() for timer callbacks only.

Type guard

Instant safeFireTimestamp(DoFn.OnTimerContext ctx) {
  try { return ctx.fireTimestamp(); }
  catch (UnsupportedOperationException e) { return null; }
}

Try / catch

try {
  Instant fireTs = context.fireTimestamp();
} catch (UnsupportedOperationException e) {
  Instant fireTs = context.timestamp(); // fall back to element timestamp where legal
}

Prevention

When it happens

Trigger: Calling context.fireTimestamp() from a @ProcessElement (non-timer) callback or bundle lifecycle callback when the DoFn is invoked with UnsupportedInvocationBehavior — e.g. direct invocation via DoFnInvokers.invokerFor(...), or a runner that has not plumbed fire timestamps.

Common situations: Adding fireTimestamp() to a ProcessElement method and running it in a unit test that invokes the DoFn directly; migrating timer-based logic into process-element code; a custom runner lacking fire-timestamp support in its DoFnRunner.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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