apache/beam · error · KeyError

No such coder: %s

Error message

No such coder: %s

What it means

get_coder looks up a coder by id in the process bundle descriptor; if the id is absent it raises KeyError('No such coder'). The pipeline proto referenced a coder id that was never registered/described to the worker, indicating the descriptor is incomplete or inconsistent.

Source

Thrown at sdks/python/apache_beam/runners/worker/bundle_processor.py:1552

  def extract_timers_info(self) -> dict[tuple[str, str], TimerInfo]:
    timers_info = {}
    for transform_id, transform_proto in self.descriptor.transforms.items():
      if transform_proto.spec.urn == common_urns.primitives.PAR_DO.urn:
        pardo_payload = proto_utils.parse_Bytes(
            transform_proto.spec.payload, beam_runner_api_pb2.ParDoPayload)
        for (timer_family_id,
             timer_family_spec) in pardo_payload.timer_family_specs.items():
          timer_coder_impl = self.get_coder(
              timer_family_spec.timer_family_coder_id).get_impl()
          # The output_stream should be updated when processing a bundle.
          timers_info[(transform_id, timer_family_id)] = TimerInfo(
              timer_coder_impl=timer_coder_impl)
    return timers_info

  def get_coder(self, coder_id: str) -> coders.Coder:
    if coder_id not in self.descriptor.coders:
      raise KeyError("No such coder: %s" % coder_id)
    coder_proto = self.descriptor.coders[coder_id]
    if coder_proto.spec.urn:
      return self.context.coders.get_by_id(coder_id)
    else:
      # No URN, assume cloud object encoding json bytes.
      return operation_specs.get_coder_from_spec(
          json.loads(coder_proto.spec.payload.decode('utf-8')))

  def get_windowed_coder(self, pcoll_id: str) -> WindowedValueCoder:
    coder = self.get_coder(self.descriptor.pcollections[pcoll_id].coder_id)
    # TODO(robertwb): Remove this condition once all runners are consistent.
    if not isinstance(coder, WindowedValueCoder):
      windowing_strategy = self.descriptor.windowing_strategies[
          self.descriptor.pcollections[pcoll_id].windowing_strategy_id]
      return WindowedValueCoder(
          coder, self.get_coder(windowing_strategy.window_coder_id))
    else:
      return coder

View on GitHub (pinned to 12126d8942)

Solutions

  1. Use matching apache_beam versions on submission and worker sides so all coders are staged
  2. Regenerate/upgrade the job graph (rerun the pipeline) if a stale cached descriptor is in use
  3. Check the pipeline proto (descriptor.coders) to see which coder id is missing and why translation skipped it
  4. If using cross-language transforms, upgrade both sides' expansion service/SDK versions

Example fix

# before: apache-beam==2.46.0 submission, 2.50.0 workers
// after: pin both
pip install apache-beam==2.50.0
# and rebuild the worker image with the same version
Defensive patterns

Strategy: try-catch

Validate before calling

def coders_complete(descriptor):
    referenced = {c for t in descriptor.transforms.values() for c in referenced_coder_ids(t)}
    missing = referenced - set(descriptor.coders)
    return not missing, missing
# call on the process_bundle_descriptor before execution if you build it yourself

Try / catch

try:
    coder = bundle_processor.get_coder(coder_id)
except KeyError as e:
    if 'No such coder' in str(e):
        logging.error('Coder %s missing from descriptor; re-staging pipeline with matching SDK version', coder_id)
        raise
    raise

Prevention

When it happens

Trigger: process_bundle_descriptor.coders lacks the requested coder_id when building operations (bundle_processor.py get_coder), typically due to a pipeline graph translation bug or a descriptor serialized/staged without all coders.

Common situations: Version mismatch between pipeline submission SDK and worker SDK dropping coders; custom/combined coders not propagated in cross-language pipelines; manually edited or cached pipeline protos.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


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