{"record":{"id":"c2502a6297bab6c7","repo":"bazelbuild/bazel","slug":"runfiles-resolved-path-to-binary-but-the-file","errorCode":null,"errorMessage":"Runfiles resolved {path} to {binary} but the file does not exist","messagePattern":"Runfiles resolved (.+?) to (.+?) but the file does not exist","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"tools/build_defs/proguard/wrapper.py","lineNumber":52,"sourceCode":"    r: The Runfiles object to use for the lookup.\n    path: The path of the binary being found.\n\n  Returns:\n    The full path to the binary.\n\n  Raises:\n    RuntimeError: If the path is not present in the runfiles, or if the adjusted\n    path does not\n    exist on the filesystem.\n  \"\"\"\n\n  if platform.system() == \"Windows\":\n    path = path + \".exe\"\n  binary = r.Rlocation(path)\n  if not binary:\n    raise RuntimeError(f\"Runfiles failed to resolve {path}\")\n  elif not os.path.exists(binary):\n    raise RuntimeError(\n        f\"Runfiles resolved {path} to {binary} but the file does not exist\"\n    )\n  return binary\n\n\ndef apply_proguard(srcs, deps, proguard_spec, output_jar):\n  \"\"\"Call proguard on the given source jars with the spec.\n\n  Args:\n    srcs: The source jars to be modified.\n    deps: Dependency jars needed to resolve the source jars.\n    proguard_spec: The path to the proguard spec file describing what\n      modifications to make.\n    output_jar: The path to write the resulting modified jar file to.\n\n  Raises:\n    RuntimeError: When the proguard binary fails, includes the stdout and\n    stderr.","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/bazelbuild/bazel/blob/e6e199d0601a244511b4cf18c8b2828aa73db1fd/tools/build_defs/proguard/wrapper.py#L34-L70","documentation":"Raised by the proguard wrapper when Rlocation() succeeds — returning a concrete filesystem path — but that path does not exist on disk. So the runfiles metadata knows the entry, yet the file itself is missing, meaning the manifest and the filesystem are out of sync.","triggerScenarios":"os.path.exists(binary) is false after a successful Rlocation: stale runfiles manifest from a previous build, a runfiles tree where the file was pruned, or a symlinked runfiles dir pointing at a cleaned output base.","commonSituations":"Reusing an old runfiles manifest after 'bazel clean' or after the producing target was renamed; external repo fetched lazily and the artifact not yet materialized; sandboxing discarding files referenced only via manifest.","solutions":["Rebuild/rerun the wrapper target so runfiles and the manifest are regenerated together (bazel run of the tool).","Check the resolved path printed in the message ('Runfiles resolved ... to ...') and confirm its parent directory exists.","If the path points into an external repo, force a refetch (bazel sync or touch the WORKSPACE entry) so the artifact is materialized."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"binary = r.Rlocation(path)\nassert binary, 'Rlocation failed for %s' % path\nassert os.path.exists(binary), 'runfiles entry stale for %s -> %s' % (path, binary)","typeGuard":null,"tryCatchPattern":"try:\n    run_tool()\nexcept RuntimeError as e:\n    if 'does not exist' in str(e):\n        rebuild_and_retry()  # regenerate runfiles via bazel run\n    raise","preventionTips":["Regenerate runfiles with the binary (bazel run) instead of reusing stale manifests after clean.","Treat manifest/filesystem mismatch as a build-cache defect and rebuild rather than hand-patching paths."],"tags":["runfiles","proguard","stale-build","bazel"],"backgroundTag":null,"analyzedSha":"e6e199d0601a244511b4cf18c8b2828aa73db1fd","analyzedAt":"2026-08-14T10:24:27.848Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}