apache/beam · error · RuntimeError
The file "%s" cannot be found. Its location was specified by
Error message
The file "%s" cannot be found. Its location was specified by the --sdk_location command-line option.
What it means
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.
Source
Thrown at sdks/python/apache_beam/runners/portability/stager.py:373
sdk_path = setup_options.sdk_location
if os.path.isfile(sdk_path):
_LOGGER.info('Copying Beam SDK "%s" to staging location.', sdk_path)
resources.append(
Stager._create_file_stage_to_artifact(
sdk_path,
Stager._desired_sdk_filename_in_staging_location(
setup_options.sdk_location)))
else:
if setup_options.sdk_location == 'default':
raise RuntimeError(
'Cannot find default Beam SDK tar file "%s"' % sdk_path)
elif not setup_options.sdk_location:
_LOGGER.info(
'Beam SDK will not be staged since --sdk_location '
'is empty.')
else:
raise RuntimeError(
'The file "%s" cannot be found. Its location was specified '
'by the --sdk_location command-line option.' % sdk_path)
# The following artifacts are not processed by python sdk container boot
# sequence in a setup mode and hence should not be skipped even if a
# prebuilt sdk container image is used.
# TODO(heejong): remove jar_packages experimental flag when cross-language
# dependency management is implemented for all runners.
# Handle jar packages that should be staged for Java SDK Harness.
jar_packages = options.view_as(DebugOptions).lookup_experiment(
'jar_packages')
if jar_packages is not None:
resources.extend(
Stager._create_jar_packages(
jar_packages.split(','), temp_dir=temp_dir))
# Pickle the main session if requested.
# We will create the pickled main session locally and then copy it to theView on GitHub (pinned to 12126d8942)
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
Example fix
// before --sdk_location=/tmp/old/apache_beam-2.59.0.tar.gz // after --sdk_location=/tmp/apache_beam-2.60.0.tar.gz
Defensive patterns
Strategy: validation
Validate before calling
sdk = '/tmp/apache_beam-2.60.0.tar.gz'
if not os.path.exists(sdk):
raise SystemExit(f'--sdk_location target missing: {sdk}') Type guard
def sdk_location_exists(p): return p in ('default', '') or os.path.exists(p) Try / catch
try:
stager.create_and_stage_job_resources(setup_options)
except RuntimeError as e:
if 'cannot be found' in str(e) and '--sdk_location' in str(e):
sys.exit(f'Check --sdk_location path: {e}')
raise Prevention
- 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
When it happens
Trigger: create_job_resources with sdk_location set to a local path where os.path.exists(sdk_path) is False.
Common situations: 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.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- The file %s cannot be found. It was specified in the --setup
- The file %s cannot be found. It was specified in the --exper
- The --setup_file option expects the full path to a file name
- The --sdk_location option was used with an unsupported type
- The --experiment='jar_packages=' option expects a full path
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/81b07343243e5b7a.
Report an issue: GitHub.