{"record":{"id":"c92a75897d3f8e16","repo":"apache/beam","slug":"transform-identify-object-spec-has-outputs-list-outputs-keys","errorCode":null,"errorMessage":"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'.","messagePattern":"Transform (.+?) has outputs (.+?), 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'\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/yaml/yaml_transform.py","lineNumber":667,"sourceCode":"      PCollections.\n    error_handling_spec (dict): The `error_handling` configuration from the\n      original transform.\n\n  Returns:\n    The key of the main output PCollection.\n\n  Raises:\n    ValueError: If a main output cannot be determined because there are\n      multiple outputs and none are named 'output' or 'good'.\n  \"\"\"\n  main_output_key = 'output'\n  if main_output_key not in outputs:\n    if 'good' in outputs:\n      main_output_key = 'good'\n    elif len(outputs) == 1:\n      main_output_key = next(iter(outputs.keys()))\n    else:\n      raise ValueError(\n          f\"Transform {identify_object(spec)} has outputs \"\n          f\"{list(outputs.keys())}, but none are named 'output' or 'good'. To \"\n          \"apply an 'output_schema', please ensure the transform has exactly \"\n          \"one output, or that the main output is named 'output' or 'good'.\")\n\n  if len(outputs) >= 3 or \\\n    (len(outputs) == 2 and error_handling_spec.get('output') not in outputs):\n    _LOGGER.warning(\n        \"There are currently %s outputs: %s. Only the main output will be \"\n        \"validated.\",\n        len(outputs),\n        outputs)\n\n  return main_output_key\n\n\ndef _integrate_validation_results(\n    outputs, validation_result, main_output_key, error_handling_spec):","sourceCodeStart":649,"sourceCodeEnd":685,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/yaml/yaml_transform.py#L649-L685","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Rename the main output to 'output' (or 'good') in the transform's outputs/outputs override.","Reduce the transform to a single output if only one logical result is needed.","Split into two transforms so validation applies to an explicitly named single output.","Use ValidateWithSchema explicitly instead of relying on implicit main-output detection."],"exampleFix":"// before\n- type: MyMultiOutput\n  config:\n    outputs: [valid, invalid]\n    output_schema: {schema: 'id: INTEGER'}\n// after\n- type: MyMultiOutput\n  config:\n    outputs: {output: valid, errors: invalid}\n    output_schema: {schema: 'id: INTEGER'}","handlingStrategy":"validation","validationCode":"def check_main_output(outputs):\n    if 'output' not in outputs and 'good' not in outputs and len(outputs) != 1:\n        raise ValueError(f\"output_schema needs a main output named 'output'/'good' or a single output; got {list(outputs)}\")","typeGuard":"def has_main_output(outputs: dict) -> bool:\n    return 'output' in outputs or 'good' in outputs or len(outputs) == 1","tryCatchPattern":"try:\n    expand_output_schema_transform(spec, outputs, eh)\nexcept ValueError as e:\n    if \"none are named 'output' or 'good'\" in str(e):\n        print('Rename main output or use single-output transform')\n    else:\n        raise","preventionTips":["Name the primary output 'output' when a transform has multiple outputs.","Avoid output_schema on multi-output transforms with custom tag names.","Use ValidateWithSchema explicitly when outputs are non-standard."],"tags":["python","apache-beam","yaml","outputs"],"backgroundTag":"missing-required-config-field","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}