{"record":{"id":"8665e11370fb6ac5","repo":"apache/beam","slug":"the-staging-location-must-be-specified","errorCode":null,"errorMessage":"The staging_location must be specified.","messagePattern":"The staging_location must be specified\\.","errorType":"validation","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/runners/portability/stager.py","lineNumber":435,"sourceCode":"\n        Stages job resources to staging_location.\n\n        Args:\n          resources: A list of tuples of local file paths and file names (no\n            paths) to be used for staging resources.\n          staging_location: Location to stage the file.\n\n        Returns:\n          A list of file names (no paths) for the resources staged. All the\n          files are assumed to be staged at staging_location.\n\n        Raises:\n          RuntimeError: If files specified are not found or error encountered\n          while trying to create the resources (e.g., build a setup package).\n        \"\"\"\n    # Make sure that all required options are specified.\n    if staging_location is None:\n      raise RuntimeError('The staging_location must be specified.')\n\n    staged_resources = []\n    for file_path, staged_path, sha256 in resources:\n      self.stage_artifact(\n          file_path, FileSystems.join(staging_location, staged_path), sha256)\n      staged_resources.append(staged_path)\n\n    return staged_resources\n\n  def create_and_stage_job_resources(\n      self,\n      options: PipelineOptions,\n      build_setup_args: Optional[list[str]] = None,\n      temp_dir: Optional[str] = None,\n      pypi_requirements: Optional[list[str]] = None,\n      populate_requirements_cache: Optional[Callable[[str, str, bool],\n                                                     None]] = None,\n      staging_location: Optional[str] = None):","sourceCodeStart":417,"sourceCodeEnd":453,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/runners/portability/stager.py#L417-L453","documentation":"stage_job_resources requires a staging_location (the remote/local directory where artifacts are uploaded). If it is None, this RuntimeError is raised before any file is staged. It is a programming/config error, since runners normally derive this from the pipeline's staging location option.","triggerScenarios":"Calling stage_job_resources (or create_and_stage_job_resources) without staging_location and without the options needed to derive it.","commonSituations":"Directly invoking Stager in custom tooling and forgetting staging_location; pipeline options missing --staging_location / --temp_location so the default resolution yields None.","solutions":["Pass staging_location explicitly to create_and_stage_job_resources/stage_job_resources","Set --staging_location (and --temp_location) in PipelineOptions","Ensure the runner's default staging path resolution is intact (e.g. valid GCS/ s3 project settings)"],"exampleFix":"// before\nstager.create_and_stage_job_resources(setup_options)\n// after\nstager.create_and_stage_job_resources(setup_options, staging_location='gs://bucket/staging')","handlingStrategy":"validation","validationCode":"staging_location = options.view_as(GoogleCloudOptions).staging_location\nif not staging_location:\n    raise SystemExit('--staging_location/--temp_location must be set')","typeGuard":"def has_staging_location(opts): return bool(getattr(opts, 'staging_location', None))","tryCatchPattern":"try:\n    stager.stage_job_resources(resources, staging_location)\nexcept RuntimeError as e:\n    if 'staging_location must be specified' in str(e):\n        sys.exit('Pass --staging_location or set it in options')\n    raise","preventionTips":["Always set --staging_location and --temp_location for remote runners","Never call Stager directly without staging_location in tooling","Centralize option construction so staging_location is never None"],"tags":["python","config","missing-argument","beam"],"backgroundTag":"missing-required-argument","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}