{"record":{"id":"f3c757853d8394b1","repo":"apache/beam","slug":"region-does-not-exist","errorCode":null,"errorMessage":"Region {} does not exist!","messagePattern":"Region (.+?) does not exist!","errorType":"validation","errorClass":"ValueError","httpStatus":501,"severity":"error","filePath":"sdks/python/apache_beam/runners/interactive/dataproc/dataproc_cluster_manager.py","lineNumber":155,"sourceCode":"              'cluster': cluster\n          })\n    except Exception as e:\n      if e.code == 409:\n        _LOGGER.info(\n            'Cluster %s already exists. Continuing...',\n            self.cluster_metadata.cluster_name)\n      elif e.code == 403:\n        _LOGGER.error(\n            'Due to insufficient project permissions, '\n            'unable to create cluster: %s',\n            self.cluster_metadata.cluster_name)\n        raise ValueError(\n            'You cannot create a cluster in project: {}'.format(\n                self.cluster_metadata.project_id))\n      elif e.code == 501:\n        _LOGGER.error(\n            'Invalid region provided: %s', self.cluster_metadata.region)\n        raise ValueError(\n            'Region {} does not exist!'.format(self.cluster_metadata.region))\n      else:\n        _LOGGER.error(\n            'Unable to create cluster: %s', self.cluster_metadata.cluster_name)\n        raise e\n    else:\n      _LOGGER.info(\n          'Cluster created successfully: %s',\n          self.cluster_metadata.cluster_name)\n      self._staging_directory = self.get_staging_location()\n      master_url, dashboard = self.get_master_url_and_dashboard()\n      self.cluster_metadata.master_url = master_url\n      self.cluster_metadata.dashboard = dashboard\n\n  def create_flink_cluster(self) -> None:\n    \"\"\"Calls _create_cluster with a configuration that enables FlinkRunner.\"\"\"\n    init_action_path = self.stage_init_action()\n    # https://cloud.google.com/php/docs/reference/cloud-dataproc/latest/V1.Cluster","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/runners/interactive/dataproc/dataproc_cluster_manager.py#L137-L173","documentation":"A Dataproc API 501 (or 'region not found') response during create_cluster is converted to ValueError('Region {} does not exist!'), meaning the region string in ClusterMetadata is not a valid Dataproc region.","triggerScenarios":"create_cluster called with an invalid region name (typo, unsupported region, or region where the Dataproc API isn't enabled) — the API responds 501/NOT_IMPLEMENTED and the manager raises this error.","commonSituations":"Passing a zone instead of a region ('us-central1-a' vs 'us-central1'); using a newly announced region not yet supported; wrong region casing; missing '-a' style suffixes misconceptions.","solutions":["Set a valid Dataproc region in ClusterMetadata (e.g. 'us-central1', 'europe-west1').","Run `gcloud dataproc regions list --project PROJECT` to see valid regions.","Ensure the region is one where the Dataproc API is available/enabled.","Fix casing and format: lowercase region, no zone suffix."],"exampleFix":"// before\nClusterMetadata(project_id='p', region='us-central1-a', ...)\n// after\nClusterMetadata(project_id='p', region='us-central1', ...)","handlingStrategy":"validation","validationCode":"import subprocess\nregions = subprocess.run(['gcloud', 'dataproc', 'regions', 'list', '--project', project,\n                          '--format=value(name)'], capture_output=True, text=True).stdout.split()\nassert region in regions, f'{region} is not a valid Dataproc region'","typeGuard":null,"tryCatchPattern":"try:\n    cluster = manager.create_flink_cluster()\nexcept ValueError as e:\n    if 'does not exist' in str(e) and 'Region' in str(e):\n        manager.cluster_metadata.region = 'us-central1'\n        cluster = manager.create_flink_cluster()","preventionTips":["Use region names (us-central1), never zone names (us-central1-a).","Verify the region with `gcloud dataproc regions list` before creating clusters.","Keep region configuration in one checked constant per project."],"tags":["apache-beam","dataproc","gcp","region","cluster"],"backgroundTag":"resource-not-found","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"}