{"record":{"id":"cf383bd6072bf48d","repo":"apache/beam","slug":"the-temp-location-option-must-be-specified","errorCode":null,"errorMessage":"The --temp_location option must be specified.","messagePattern":"The --temp_location option must be specified\\.","errorType":"validation","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/runners/dataflow/internal/apiclient.py","lineNumber":604,"sourceCode":"    else:\n      self._uncached_gcs_file_copy(from_path, cached_path)\n\n    FileSystems.copy(\n        source_file_names=[cached_path], destination_file_names=[to_path])\n    _LOGGER.info('Copied cached artifact from %s to %s', from_path, to_path)\n\n  def _uncached_gcs_file_copy(self, from_path, to_path):\n    to_folder, to_name = os.path.split(to_path)\n    total_size = os.path.getsize(from_path)\n    self.stage_file_with_retry(\n        to_folder, to_name, from_path, total_size=total_size)\n\n  def _stage_resources(self, pipeline, options):\n    google_cloud_options = options.view_as(GoogleCloudOptions)\n    if google_cloud_options.staging_location is None:\n      raise RuntimeError('The --staging_location option must be specified.')\n    if google_cloud_options.temp_location is None:\n      raise RuntimeError('The --temp_location option must be specified.')\n\n    resources = []\n    staged_paths = {}\n    staged_hashes = {}\n    for _, env in sorted(pipeline.components.environments.items(),\n                         key=lambda kv: kv[0]):\n      for dep in env.dependencies:\n        if dep.type_urn != common_urns.artifact_types.FILE.urn:\n          raise RuntimeError('unsupported artifact type %s' % dep.type_urn)\n        type_payload = beam_runner_api_pb2.ArtifactFilePayload.FromString(\n            dep.type_payload)\n\n        if dep.role_urn == common_urns.artifact_roles.STAGING_TO.urn:\n          remote_name = (\n              beam_runner_api_pb2.ArtifactStagingToRolePayload.FromString(\n                  dep.role_payload)).staged_name\n          is_staged_role = True\n        else:","sourceCodeStart":586,"sourceCodeEnd":622,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/runners/dataflow/internal/apiclient.py#L586-L622","documentation":"Raised during _stage_resources (invoked from create_job_description) when preparing a Dataflow job: staging the pipeline's resources to GCS requires a staging location, and the --temp_location option (or the stage/temp_location derived from it) was not set on the pipeline's GoogleCloudOptions. It fires at job-creation time when neither --temp_location nor an implicit temp/staging location could be resolved from the options, so the remote workflow cannot upload files.","triggerScenarios":"create_job_description() -> _stage_resources() with options lacking --temp_location (and no earlier validation catching it, e.g. Job constructed directly).","commonSituations":"Job objects built manually or by tooling that skips DataflowJob __init__ validation; template-based submissions missing temp_location; options parsed from a config file that dropped the key.","solutions":["Add --temp_location=gs://<bucket>/<path> to pipeline options","Set it via GoogleCloudOptions(temp_location='gs://...') before creating the Job","If staging_location is set but temp is not, remember __init__ defaults staging from temp, not the reverse — set both explicitly"],"exampleFix":"# before\njob = Job(pipeline, options)  # options lacks temp_location\n# after\noptions.view_as(GoogleCloudOptions).temp_location = 'gs://my-bucket/temp'\njob = Job(pipeline, options)","handlingStrategy":"validation","validationCode":"if options.view_as(GoogleCloudOptions).temp_location is None:\n    raise SystemExit('set --temp_location (gs://bucket/temp)')","typeGuard":"def has_temp(options) -> bool:\n    return options.view_as(GoogleCloudOptions).temp_location is not None","tryCatchPattern":null,"preventionTips":["Set temp_location in every Dataflow launch configuration","Note that staging_location does not default temp_location — set temp explicitly","Validate options early in the job-submission wrapper"],"tags":["dataflow","configuration","gcs","temp-location"],"backgroundTag":"missing-required-flag","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}