apache/beam · error · ValueError

specifies a destination for an invalid SDK: ' '. The…

Error message

{message} specifies a destination for an invalid SDK: '{sdk}'. The supported SDKs are {SUPPORTED_SDK_DESTINATIONS}

What it means

validate_sdks_destinations checks that each SDK key in an expansion service's destinations mapping is one of SUPPORTED_SDK_DESTINATIONS. An unknown SDK key (e.g. a typo or a newly added SDK not yet supported by the generator) raises ValueError listing the supported SDKs.

Solutions

  1. Correct the SDK key in the YAML to one of the supported names listed in the error message.
  2. If a new SDK must be supported, add it to SUPPORTED_SDK_DESTINATIONS in gen_xlang_wrappers.py along with generation logic.
  3. Re-run the wrapper generation.

Example fix

// before
  destinations:
    py: sdks/python/apache_beam/transforms
// after
  destinations:
    python: sdks/python/apache_beam/transforms
Defensive patterns

Strategy: validation

Validate before calling

from gen_xlang_wrappers import SUPPORTED_SDK_DESTINATIONS
for svc in services:
    for sdk in svc['destinations']:
        assert sdk in SUPPORTED_SDK_DESTINATIONS, f"bad sdk key: {sdk}"

Type guard

def has_valid_sdks(svc):
    from gen_xlang_wrappers import SUPPORTED_SDK_DESTINATIONS
    return all(s in SUPPORTED_SDK_DESTINATIONS for s in svc.get('destinations', {}))

Try / catch

try:
    generate_transforms_config(services_yaml, ...)
except ValueError as e:
    if 'invalid SDK' in str(e):
        print('Use one of the supported SDK keys listed in the error')

Prevention

When it happens

Trigger: A destinations entry in the expansion services YAML (or an identifier-annotated per-transform override) uses an SDK name not present in SUPPORTED_SDK_DESTINATIONS during generate_transforms_config.

Common situations: Typo like 'py' or 'Python' instead of 'python'; adding a new SDK destination before updating SUPPORTED_SDK_DESTINATIONS.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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

Appendix: source

Thrown at sdks/python/gen_xlang_wrappers.py:197

        "# NOTE: This file is autogenerated and should "
        "not be edited by hand.\n")
    f.write(
        "# Configs are generated based on the expansion service\n"
        f"# configuration in {input_services.replace(PROJECT_ROOT, '')}.\n")
    f.write("# Refer to gen_xlang_wrappers.py for more info.\n")
    dt = datetime.datetime.now().date()
    f.write(f"#\n# Last updated on: {dt}\n\n")
    yaml.dump(transform_list, f)
  logging.info("Successfully wrote transform configs to file: %s", output_file)


def validate_sdks_destinations(sdk, dest, service, identifier=None):
  if identifier:
    message = f"Identifier '{identifier}'"
  else:
    message = f"Service '{service}'"
  if sdk not in SUPPORTED_SDK_DESTINATIONS:
    raise ValueError(
        message + " specifies a destination for an invalid SDK:"
        f" '{sdk}'. The supported SDKs are {SUPPORTED_SDK_DESTINATIONS}")
  if not os.path.isdir(os.path.join(PYTHON_SDK_ROOT, *dest.split('/'))):
    raise ValueError(
        message + f" specifies an invalid destination '{dest}'."
        " Please make sure the destination is an existing directory.")


def pretty_type(tp):
  """
  Takes a type and returns a tuple containing a pretty string representing it
  and a bool signifying if it is nullable or not.

  For optional types, the contained type is unwrapped and returned. This does
  not recurse however, so inner Optional types are not affected.
  E.g. the input typing.Optional[typing.Dict[int, typing.Optional[str]]] will
  return (Dict[int, Union[str, NoneType]], True)
  """

View on GitHub (pinned to 12126d8942)