{"record":{"id":"3f817cd29cfc4155","repo":"apache/beam","slug":"unknown-cloud-build-machine-type-option-please-specify-one","errorCode":null,"errorMessage":"Unknown Cloud Build Machine Type option, please specify one of [n1-highcpu-8, n1-highcpu-32, e2-highcpu-8, e2-highcpu-32].","messagePattern":"Unknown Cloud Build Machine Type option, please specify one of \\[n1-highcpu-8, n1-highcpu-32, e2-highcpu-8, e2-highcpu-32\\]\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/runners/portability/sdk_container_builder.py","lineNumber":371,"sourceCode":"      tar.add(source_dir, arcname=SOURCE_FOLDER)\n\n  @staticmethod\n  def _get_cloud_build_machine_type_enum(machine_type: str):\n    from google.cloud.devtools.cloudbuild_v1 import types as cloud_build_types\n    if not machine_type:\n      return None\n    mappings = {\n        'n1-highcpu-8': cloud_build_types.BuildOptions.MachineType.N1_HIGHCPU_8,\n        'n1-highcpu-32': cloud_build_types.BuildOptions.MachineType.\n        N1_HIGHCPU_32,\n        'e2-highcpu-8': cloud_build_types.BuildOptions.MachineType.E2_HIGHCPU_8,\n        'e2-highcpu-32': cloud_build_types.BuildOptions.MachineType.\n        E2_HIGHCPU_32\n    }\n    if machine_type.lower() in mappings:\n      return mappings[machine_type.lower()]\n    else:\n      raise ValueError(\n          'Unknown Cloud Build Machine Type option, please specify one of '\n          '[n1-highcpu-8, n1-highcpu-32, e2-highcpu-8, e2-highcpu-32].')\n","sourceCodeStart":353,"sourceCodeEnd":374,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/runners/portability/sdk_container_builder.py#L353-L374","documentation":"_get_cloud_build_machine_type_enum maps a machine type string to the google-cloud-build MachineType enum. If the provided machine_type string (case-insensitive) is not one of the four supported n1/e2-highcpu options, ValueError lists the accepted values.","triggerScenarios":"Constructing the Cloud Build container builder (__init__ path) with a cloud_build_machine_type value other than n1-highcpu-8, n1-highcpu-32, e2-highcpu-8, or e2-highcpu-32 (case-insensitive).","commonSituations":"Passing N1-HIGHCPU-8 variants with dashes misspelled (e.g. 'n1-highcpu-16' which is not mapped), 'standard', 'e2-standard-8', or empty strings from config files.","solutions":["Use exactly one of: n1-highcpu-8, n1-highcpu-32, e2-highcpu-8, e2-highcpu-32 (any case)","Check your pipeline option/config supplying cloud_build_machine_type for typos","Remove the machine type option to use the Cloud Build default if unsure"],"exampleFix":"// before\nmachine_type = 'n1-highcpu-16'\n// after\nmachine_type = 'n1-highcpu-32'","handlingStrategy":"validation","validationCode":"VALID = {'n1-highcpu-8', 'n1-highcpu-32', 'e2-highcpu-8', 'e2-highcpu-32'}\nmt = (options.cloud_build_machine_type or '').lower()\nassert mt in VALID, f'cloud_build_machine_type {mt!r} invalid; choose from {sorted(VALID)}'","typeGuard":"def is_valid_machine_type(mt: str) -> bool:\n    return mt.lower() in {'n1-highcpu-8', 'n1-highcpu-32', 'e2-highcpu-8', 'e2-highcpu-32'}","tryCatchPattern":"try:\n    builder = SdkContainerImageBuilder(..., cloud_build_machine_type=mt)\nexcept ValueError as e:\n    if 'Unknown Cloud Build Machine Type' in str(e):\n        logger.warning('%s; using default machine type', e)\n        builder = SdkContainerImageBuilder(..., cloud_build_machine_type=None)\n    else:\n        raise","preventionTips":["Centralize the machine type in one config constant validated at startup","Only use the four documented highcpu machine types for Cloud Build SDK pre-builds","Normalize case (the check is case-insensitive) but never alter the spelling of the value"],"tags":["apache-beam","google-cloud-build","machine-type","invalid-option"],"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"}