{"record":{"id":"d2effb4ca75292a1","repo":"apache/beam","slug":"file-s-not-found","errorCode":null,"errorMessage":"File %s not found.","messagePattern":"File (.+?) not found\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/runners/portability/stager.py","lineNumber":898,"sourceCode":"                Stager._get_python_executable(),\n                os.path.basename(setup_file),\n                'sdist',\n                '--dist-dir',\n                temp_dir\n            ]\n            _LOGGER.info('Executing command: %s', build_setup_args)\n            processes.check_output(build_setup_args)\n          else:\n            # If it's pyproject.toml and `python -m build` failed,\n            # there's no direct legacy fallback.\n            raise RuntimeError(\n                f\"Failed to build package from '{setup_file}' using . \"\n                f\"'python -m build'. Please ensure that the 'build' module \"\n                f\"is installed and your project's build configuration is valid.\"\n            )\n      output_files = glob.glob(os.path.join(temp_dir, '*.tar.gz'))\n      if not output_files:\n        raise RuntimeError(\n            'File %s not found.' % os.path.join(temp_dir, '*.tar.gz'))\n      return output_files[0]\n    finally:\n      os.chdir(saved_current_directory)\n\n  @staticmethod\n  def _desired_sdk_filename_in_staging_location(sdk_location) -> str:\n    \"\"\"Returns the name that SDK file should have in the staging location.\n      Args:\n        sdk_location: Full path to SDK file.\n      \"\"\"\n    if sdk_location.endswith('.whl'):\n      _, wheel_filename = FileSystems.split(sdk_location)\n      if wheel_filename.startswith('apache_beam'):\n        return wheel_filename\n      else:\n        raise RuntimeError('Unrecognized SDK wheel file: %s' % sdk_location)\n    else:","sourceCodeStart":880,"sourceCodeEnd":916,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/runners/portability/stager.py#L880-L916","documentation":"Raised by Stager._build_setup_package after a (seemingly successful) build when no *.tar.gz artifact was produced in the temporary build directory. It catches builds that complete without emitting a source distribution. The raised message reports the glob pattern, not a specific file.","triggerScenarios":"--setup_file build runs but the configured build backend writes output elsewhere (or produces only wheels), leaving the temp dir without any .tar.gz file.","commonSituations":"Custom setup.py or build backend that skips sdist; build config redirecting dist output outside temp_dir; partially failing builds that exit 0 but produce nothing.","solutions":["Ensure the project's build produces a source distribution (sdist .tar.gz) in the build directory","Run 'python setup.py sdist' manually to confirm a tar.gz is generated","Check setup.cfg/pyproject.toml for settings that redirect build output","Update Beam or inspect Stager._build_setup_package if a backend change relocated artifacts"],"exampleFix":"# before\n# setup.cfg omitted sdist; only bdist_wheel ran -> 'File .../*.tar.gz not found.'\n# after\n[bdist_wheel]\nuniversal = 0\n# plus ensure: python setup.py sdist  (or 'python -m build --sdist') succeeds in the project dir","handlingStrategy":"validation","validationCode":"import subprocess, glob, os\ndef sdist_produces_tarball(setup_dir):\n    tmp = '/tmp/_sdist_check'\n    subprocess.run(['python', 'setup.py', 'sdist', '--dist-dir', tmp], cwd=setup_dir, check=True)\n    return bool(glob.glob(os.path.join(tmp, '*.tar.gz')))\nassert sdist_produces_tarball('/path/to/project'), 'Project does not produce an sdist .tar.gz'","typeGuard":null,"tryCatchPattern":"try:\n    stage(setup_file=setup_file)\nexcept RuntimeError as e:\n    if 'not found' in str(e) and '*.tar.gz' in str(e):\n        sys.exit('Build produced no sdist; run \"python setup.py sdist\" locally to debug.')\n    raise","preventionTips":["Confirm 'python setup.py sdist' (or python -m build --sdist) emits a tar.gz for your project","Avoid build configs that redirect dist output outside the default dist directory","Keep setup.py-based projects sdist-capable when used as Beam --setup_file"],"tags":["python","apache-beam","packaging","sdist"],"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-20T03:17:13.778Z"}