apache/beam · error · ValueError

Invalid value " " for "type". When specifying a dict for…

Error message

Invalid value "{type}" for "type". When specifying a dict for type, it must follow this format: {"outer": [list of inputs to outer join]}. Example: {"outer": ["input1", "input2"]}

What it means

Thrown by _validate_type when 'type' is a dict but malformed: it must contain exactly one key 'outer' mapping to a list, e.g. {"outer": ["input1", "input2"]}. Any other key, more than one key, or a non-list 'outer' value triggers this.

Solutions

  1. Use exactly {"outer": ["input1", ...]} with 'outer' as the sole key mapping to a list of input tags.
  2. For non-outer joins use the plain string form instead of a dict.
  3. Verify with the example in the error message.

Example fix

// before
type: {outer: input1}
// after
type: {outer: [input1, input2]}
Defensive patterns

Strategy: validation

Validate before calling

if isinstance(t, dict) and (list(t) != ['outer'] or not isinstance(t.get('outer'), list)):
    raise ValueError('dict type must be exactly {"outer": [input tags]}')

Type guard

def is_valid_outer_type_dict(t):
    return isinstance(t, dict) and list(t) == ['outer'] and isinstance(t['outer'], list)

Prevention

When it happens

Trigger: type: {outer: input1} (outer not a list); type: {left: [...]} (wrong key); type: {outer: [...], inner: [...]} (multiple keys).

Common situations: Authors familiar with pandas merge semantics guessing at the format; writing outer joins for more than one subset of inputs; YAML indentation mistakes nesting the list wrong.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


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

Appendix: source

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

        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()):
        raise ValueError(
            f'{error_prefix} An invalid input "{input}" was specified.')
  if isinstance(type, str) and type not in ('inner', 'outer', 'left', 'right'):
    raise ValueError(
        f'{error_prefix} When specifying the value for type as a str, '
        f'it must be one of the following: "inner", "outer", "left", "right"')


def _validate_equalities(equalities, pcolls):
  error_prefix = f'Invalid value "{equalities}" for "equalities".'

  valid_cols = {
      name: set(
          dict(fields).keys() if fields and all(
              isinstance(field, tuple) for field in fields) else fields)
      for (name, pcoll) in pcolls.items()
      for fields in [getattr(pcoll.element_type, '_fields', [])]
  }

View on GitHub (pinned to 12126d8942)