{"record":{"id":"81b07343243e5b7a","repo":"apache/beam","slug":"the-file-s-cannot-be-found-its-location-was-specified-by-the","errorCode":null,"errorMessage":"The file \"%s\" cannot be found. Its location was specified by the --sdk_location command-line option.","messagePattern":"The file \"(.+?)\" cannot be found\\. Its location was specified by the --sdk_location command-line option\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/runners/portability/stager.py","lineNumber":373,"sourceCode":"            sdk_path = setup_options.sdk_location\n\n          if os.path.isfile(sdk_path):\n            _LOGGER.info('Copying Beam SDK \"%s\" to staging location.', sdk_path)\n            resources.append(\n                Stager._create_file_stage_to_artifact(\n                    sdk_path,\n                    Stager._desired_sdk_filename_in_staging_location(\n                        setup_options.sdk_location)))\n          else:\n            if setup_options.sdk_location == 'default':\n              raise RuntimeError(\n                  'Cannot find default Beam SDK tar file \"%s\"' % sdk_path)\n            elif not setup_options.sdk_location:\n              _LOGGER.info(\n                  'Beam SDK will not be staged since --sdk_location '\n                  'is empty.')\n            else:\n              raise RuntimeError(\n                  'The file \"%s\" cannot be found. Its location was specified '\n                  'by the --sdk_location command-line option.' % sdk_path)\n    # The following artifacts are not processed by python sdk container boot\n    # sequence in a setup mode and hence should not be skipped even if a\n    # prebuilt sdk container image is used.\n\n    # TODO(heejong): remove jar_packages experimental flag when cross-language\n    #   dependency management is implemented for all runners.\n    # Handle jar packages that should be staged for Java SDK Harness.\n    jar_packages = options.view_as(DebugOptions).lookup_experiment(\n        'jar_packages')\n    if jar_packages is not None:\n      resources.extend(\n          Stager._create_jar_packages(\n              jar_packages.split(','), temp_dir=temp_dir))\n\n    # Pickle the main session if requested.\n    # We will create the pickled main session locally and then copy it to the","sourceCodeStart":355,"sourceCodeEnd":391,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/runners/portability/stager.py#L355-L391","documentation":"When --sdk_location points to an explicit (non-default, non-empty) local path that does not exist, create_job_resources raises this RuntimeError naming the missing file. Remote locations are handled earlier; this branch is for explicit local tarball paths.","triggerScenarios":"create_job_resources with sdk_location set to a local path where os.path.exists(sdk_path) is False.","commonSituations":"Pointing --sdk_location at a previously built tarball that was deleted; wrong absolute path; tarball built on another machine; using a relative path from a different working directory.","solutions":["Correct --sdk_location to an existing local apache_beam-*.tar.gz path","Rebuild the tarball (python setup.py sdist) if it was deleted","Use --sdk_location='default' or a https URL to a released SDK tarball","Verify with `ls -l` that the file exists on the driver host"],"exampleFix":"// before\n--sdk_location=/tmp/old/apache_beam-2.59.0.tar.gz\n// after\n--sdk_location=/tmp/apache_beam-2.60.0.tar.gz","handlingStrategy":"validation","validationCode":"sdk = '/tmp/apache_beam-2.60.0.tar.gz'\nif not os.path.exists(sdk):\n    raise SystemExit(f'--sdk_location target missing: {sdk}')","typeGuard":"def sdk_location_exists(p): return p in ('default', '') or os.path.exists(p)","tryCatchPattern":"try:\n    stager.create_and_stage_job_resources(setup_options)\nexcept RuntimeError as e:\n    if 'cannot be found' in str(e) and '--sdk_location' in str(e):\n        sys.exit(f'Check --sdk_location path: {e}')\n    raise","preventionTips":["Build the SDK tarball on the same host that submits the job","Keep tarballs in stable, absolute locations","Verify existence in a pre-submit smoke check"],"tags":["python","cli","file-not-found","beam"],"backgroundTag":"file-not-found","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"}