apache/beam · error · ValueError

Invalid input specified. There should be at least 2 inputs…

Error message

Invalid input {pcolls} specified. There should be at least 2 inputs to join.

What it means

_validate_input, called by the YAML Join transform's expansion, found fewer than two input PCollections; joining is a binary-or-more operation, so a single (or empty) input dict has nothing to join together.

Solutions

  1. Provide at least two named PCollections as inputs.
  2. If only one input exists, remove the join or replace it with a map/SQL transform.
  3. Check upstream conditional logic that may have omitted inputs.

Example fix

// before
join({'input1': pc1})
// after
join({'input1': pc1, 'input2': pc2})
Defensive patterns

Strategy: validation

Validate before calling

if len(inputs) < 2:
    raise ValueError('Join requires at least 2 inputs')

Prevention

When it happens

Trigger: Calling _SqlJoinTransform with a dict containing 0 or 1 entries, e.g. {'input1': pc1} or {}.

Common situations: YAML pipelines where some inputs were removed but the join transform left in place; dynamically built pipelines where conditional inputs were dropped; copy-paste leaving only one input.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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

Appendix: source

Thrown at sdks/python/apache_beam/yaml/yaml_join.py:32

# See the License for the specific language governing permissions and
# limitations under the License.
#

"""This module defines the Join operation."""
from typing import Any
from typing import Optional
from typing import Union

import apache_beam as beam
from apache_beam.yaml import yaml_provider


def _validate_input(pcolls):
  error_prefix = f'Invalid input {pcolls} specified.'
  if not isinstance(pcolls, dict):
    raise ValueError(f'{error_prefix} It must be a dict.')
  if len(pcolls) < 2:
    raise ValueError(
        f'{error_prefix} There should be at least 2 inputs to join.')


def _validate_type(type, pcolls):
  error_prefix = f'Invalid value "{type}" for "type".'
  if not isinstance(type, dict) and not isinstance(type, str):
    raise ValueError(f'{error_prefix} It must be a dict or a str.')
  if isinstance(type, dict):
    error = ValueError(
        f'{error_prefix} When specifying a dict for type, '
        f'it must follow this format: '
        f'{{"outer": [list of inputs to outer join]}}. '
        f'Example: {{"outer": ["input1", "input2"]}}')
    if (len(type) != 1 or next(iter(type)) != 'outer' or
        not isinstance(type['outer'], list)):
      raise error
    for input in type['outer']:
      if input not in list(pcolls.keys()):

View on GitHub (pinned to 12126d8942)