apache/beam · error · ValueError

Transform has outputs , but none are named 'output' or…

Error message

Transform {identify_object(spec)} has outputs {list(outputs.keys())}, but none are named 'output' or 'good'. To apply an 'output_schema', please ensure the transform has exactly one output, or that the main output is named 'output' or 'good'.

What it means

get_main_output_key determines which output of a multi-output transform the output_schema validation should apply to. It looks for an output named 'output', then 'good', then a single output; if none of these apply, it raises this ValueError listing the actual output names.

Solutions

  1. Rename the main output to 'output' (or 'good') in the transform's outputs/outputs override.
  2. Reduce the transform to a single output if only one logical result is needed.
  3. Split into two transforms so validation applies to an explicitly named single output.
  4. Use ValidateWithSchema explicitly instead of relying on implicit main-output detection.

Example fix

// before
- type: MyMultiOutput
  config:
    outputs: [valid, invalid]
    output_schema: {schema: 'id: INTEGER'}
// after
- type: MyMultiOutput
  config:
    outputs: {output: valid, errors: invalid}
    output_schema: {schema: 'id: INTEGER'}
Defensive patterns

Strategy: validation

Validate before calling

def check_main_output(outputs):
    if 'output' not in outputs and 'good' not in outputs and len(outputs) != 1:
        raise ValueError(f"output_schema needs a main output named 'output'/'good' or a single output; got {list(outputs)}")

Type guard

def has_main_output(outputs: dict) -> bool:
    return 'output' in outputs or 'good' in outputs or len(outputs) == 1

Try / catch

try:
    expand_output_schema_transform(spec, outputs, eh)
except ValueError as e:
    if "none are named 'output' or 'good'" in str(e):
        print('Rename main output or use single-output transform')
    else:
        raise

Prevention

When it happens

Trigger: Applying output_schema to a transform with 2+ outputs whose keys don't include 'output' or 'good' (e.g. outputs named 'valid'/'invalid', or custom tags from error_handling).

Common situations: Using output_schema with transforms that emit custom named tags (like ReadFromKafka with multiple subscriptions, or transforms whose error output is a custom name); renaming outputs with an output override without keeping a main 'output' key.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


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

Appendix: source

Thrown at sdks/python/apache_beam/yaml/yaml_transform.py:667

      PCollections.
    error_handling_spec (dict): The `error_handling` configuration from the
      original transform.

  Returns:
    The key of the main output PCollection.

  Raises:
    ValueError: If a main output cannot be determined because there are
      multiple outputs and none are named 'output' or 'good'.
  """
  main_output_key = 'output'
  if main_output_key not in outputs:
    if 'good' in outputs:
      main_output_key = 'good'
    elif len(outputs) == 1:
      main_output_key = next(iter(outputs.keys()))
    else:
      raise ValueError(
          f"Transform {identify_object(spec)} has outputs "
          f"{list(outputs.keys())}, but none are named 'output' or 'good'. To "
          "apply an 'output_schema', please ensure the transform has exactly "
          "one output, or that the main output is named 'output' or 'good'.")

  if len(outputs) >= 3 or \
    (len(outputs) == 2 and error_handling_spec.get('output') not in outputs):
    _LOGGER.warning(
        "There are currently %s outputs: %s. Only the main output will be "
        "validated.",
        len(outputs),
        outputs)

  return main_output_key


def _integrate_validation_results(
    outputs, validation_result, main_output_key, error_handling_spec):

View on GitHub (pinned to 12126d8942)