apache/beam · error · ValueError

placement_id must be specified

Error message

placement_id must be specified

What it means

Constructor guard for the Recommendations AI prediction transform: placement_id is required because it selects the set of models (the 'placement') that will serve predictions, and no sensible default exists for it.

Solutions

  1. Supply the placement_id argument, e.g. placement_id='recently_viewed'
  2. Find valid placement IDs in the Recommendations AI console under your engine's placements
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at sdks/python/apache_beam/ml/gcp/recommendations_ai.py:539 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/743d0f33361a3549. Report an issue: GitHub.

Appendix: source

Thrown at sdks/python/apache_beam/ml/gcp/recommendations_ai.py:539

            metadata: Optional. Strings which
              should be sent along with the request as metadata.
            catalog_name (str): Optional. Name of the catalog.
              Default: 'default_catalog'
            event_store (str): Optional. Name of the event store.
              Default: 'default_event_store'
            placement_id (str): Required. ID of the recommendation engine
              placement. This id is used to identify the set of models that
              will be used to make the prediction.
        """
    self.project = project
    self.retry = retry
    self.timeout = timeout
    self.metadata = metadata
    self.placement_id = placement_id
    self.catalog_name = catalog_name
    self.event_store = event_store
    if placement_id is None:
      raise ValueError('placement_id must be specified')
    else:
      self.placement_id = placement_id

  def expand(self, pcoll):
    if self.project is None:
      self.project = pcoll.pipeline.options.view_as(GoogleCloudOptions).project
    if self.project is None:
      raise ValueError(
          'GCP project name needs to be specified in "project" pipeline option')
    return pcoll | ParDo(
        _PredictUserEventFn(
            self.project,
            self.retry,
            self.timeout,
            self.metadata,
            self.catalog_name,
            self.event_store,
            self.placement_id))

View on GitHub (pinned to 12126d8942)