{"record":{"id":"1299b58500a73542","repo":"apache/beam","slug":"unknown-environment-type-s","errorCode":null,"errorMessage":"Unknown environment type: %s","messagePattern":"Unknown environment type: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/transforms/environments.py","lineNumber":276,"sourceCode":"      options: The PortableOptions object.\n    \"\"\"\n    if cls != Environment:\n      raise NotImplementedError\n\n    portable_options = options.view_as(PortableOptions)\n    environment_type = portable_options.environment_type\n    if not environment_type:\n      environment_urn = common_urns.environments.DOCKER.urn\n    elif environment_type.startswith('beam:env:'):\n      environment_urn = environment_type\n    elif environment_type == 'LOOPBACK':\n      environment_urn = python_urns.EMBEDDED_PYTHON_LOOPBACK\n    else:\n      try:\n        environment_urn = getattr(\n            common_urns.environments, environment_type).urn\n      except AttributeError:\n        raise ValueError('Unknown environment type: %s' % environment_type)\n\n    env_class = Environment.get_env_cls_from_urn(environment_urn)\n    return env_class.from_options(portable_options)  # type: ignore\n\n\n@Environment.register_urn(common_urns.environments.DEFAULT.urn, None)\nclass DefaultEnvironment(Environment):\n  \"\"\"Used as a stub when context is missing a default environment.\"\"\"\n  def to_runner_api_parameter(self, context):\n    return common_urns.environments.DEFAULT.urn, None\n\n  @staticmethod\n  def from_runner_api_parameter(\n      payload,  # type: beam_runner_api_pb2.DockerPayload\n      capabilities,  # type: Iterable[str]\n      artifacts,  # type: Iterable[beam_runner_api_pb2.ArtifactInformation]\n      resource_hints,  # type: Mapping[str, bytes]\n      context  # type: PipelineContext","sourceCodeStart":258,"sourceCodeEnd":294,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/transforms/environments.py#L258-L294","documentation":"Environment.from_options maps a PortableOptions.environment_type string to a registered environment URN via getattr on common_urns.environments; an unknown name raises AttributeError, converted to ValueError 'Unknown environment type: %s'.","triggerScenarios":"Pipeline options specify an environment_type (e.g. --environment_type=...) that is not one of the Beam environment enum names (DOCKER, PROCESS, EXTERNAL, LOOPBACK, EMBEDDED_PYTHON, etc.).","commonSituations":"Typo in --environment_type, custom runner passing a free-form string, or using an environment name added in a newer Beam version than installed.","solutions":["Use a valid environment_type value (e.g. DOCKER, PROCESS, EXTERNAL, LOOPBACK).","Check the installed Beam version's common_urns.environments enum for supported names.","If you need a custom environment, configure environment_config with the EXTERNAL type instead."],"exampleFix":"// before\n--environment_type=cloud\n// after\n--environment_type=DOCKER","handlingStrategy":"validation","validationCode":"from apache_beam.portability.api import beam_runner_api_pb2\ndef valid_env_type(name):\n    return name in ('DOCKER', 'PROCESS', 'EXTERNAL', 'LOOPBACK', 'EMBEDDED_PYTHON', 'EMBEDDED_GO')","typeGuard":null,"tryCatchPattern":"try:\n    env = Environment.from_options(options)\nexcept ValueError as e:\n    if str(e).startswith('Unknown environment type'): ...","preventionTips":["Copy --environment_type values from official Beam docs for your installed version.","Add a CLI-arg validation step in launch scripts."],"tags":["beam","environment","invalid-enum","pipeline-options","runner"],"backgroundTag":"invalid-enum-value","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"}