{"record":{"id":"43aebb58893a74cd","repo":"bazelbuild/bazel","slug":"runfiles-failed-to-resolve-path","errorCode":null,"errorMessage":"Runfiles failed to resolve {path}","messagePattern":"Runfiles failed to resolve (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"tools/build_defs/proguard/wrapper.py","lineNumber":50,"sourceCode":"\n  Args:\n    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:","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/bazelbuild/bazel/blob/e6e199d0601a244511b4cf18c8b2828aa73db1fd/tools/build_defs/proguard/wrapper.py#L32-L68","documentation":"Raised by the proguard wrapper tool when the runfiles library's Rlocation() returns a falsy value for the requested binary path. That means the path is not declared in the runfiles manifest/tree, so the wrapper cannot locate the proguard (or other) executable it was asked to run.","triggerScenarios":"Calling GetBinary with a runfiles path (with '.exe' appended on Windows) that is not among the runfiles entries — typically because the tool target is missing a data/srcs dep on the binary, or the path spelling does not match the workspace-relative runfiles path.","commonSituations":"Running the proguard wrapper outside bazel (no runfiles env at all); a new proguard binary added without updating the wrapper's deps; mismatched repo name so the runfiles key has a different prefix.","solutions":["Verify the exact runfiles path: 'workspace_name/path/to/binary' (plus '.exe' on Windows) against the runfiles manifest next to the wrapper.","Add the binary to the wrapper target's data/deps so it appears in runfiles.","Run the tool under bazel (bazel run / as a build action) so the runfiles manifest or tree exists; do not invoke the script directly from the source tree."],"exampleFix":"# before\nbinary = GetBinary(r, \"proguard\")  # not a runfiles root path\n\n# after\nbinary = GetBinary(r, \"third_party/java/proguard/proguard\")  # exact workspace-relative runfiles path","handlingStrategy":"validation","validationCode":"runfiles_paths = set(r.List())  # or read the manifest\nif path not in runfiles_paths:\n    raise ValueError('%s not declared in runfiles; add it to deps' % path)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Declare every binary the wrapper invokes in the tool target's data/deps.","Run tools through bazel so runfiles metadata always matches the build."],"tags":["runfiles","proguard","android","bazel"],"backgroundTag":null,"analyzedSha":"e6e199d0601a244511b4cf18c8b2828aa73db1fd","analyzedAt":"2026-08-14T10:24:27.848Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}