prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  `./pants run` crashes when `remote_cache_eager_fetch = false`
  **Describe the bug**
  
  After setting `remote_cache_eager_fetch = false`, a CI step that `./pants run`s a `pex_binary` has started (intermittently) failing with errors like:
  ```
   Exception: Was not present in either the local or remote store: Digest { hash: Fingerprint<46683dec8706b7ac7c4f6011f68b4b8c10ad423ae8ba57745a6f5e01ba5b2f7b>, size_bytes: 11827 }
  ```
  
  **Pants version**
  
  `PANTS_SHA=5d8a328d72209863986c8959b20305505bc068ba`
  
  **OS**
  
  Linux
  
  **Additional info**
  
  Some BuildSense links where we've seen the failure:
  * https://app.toolchain.com/organizations/color/repos/color/builds/pants_run_2022_06_27_19_29_46_827_37a3a5f2d8e440cca373a7fb4a5d3b51/
  * https://app.toolchain.com/organizations/color/repos/color/builds/pants_run_2022_06_27_19_31_09_277_3793f53b54914135885f2ac951faf210/
  * https://app.toolchain.com/organizations/color/repos/color/builds/pants_run_2022_06_27_19_29_46_827_37a3a5f2d8e440cca373a7fb4a5d3b51/
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `src/python/pants/base/exceptions.py`
  Content:
  ```
  1 # Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
  2 # Licensed under the Apache License, Version 2.0 (see LICENSE).
  3 
  4 from __future__ import annotations
  5 
  6 
  7 class TargetDefinitionException(Exception):
  8     """Indicates an invalid target definition.
  9 
  10     :API: public
  11     """
  12 
  13     def __init__(self, target, msg):
  14         """
  15         :param target: the target in question
  16         :param string msg: a description of the target misconfiguration
  17         """
  18         super().__init__(f"Invalid target {target}: {msg}")
  19 
  20 
  21 class BuildConfigurationError(Exception):
  22     """Indicates an error in a pants installation's configuration."""
  23 
  24 
  25 class BackendConfigurationError(BuildConfigurationError):
  26     """Indicates a plugin backend with a missing or malformed register module."""
  27 
  28 
  29 class MappingError(Exception):
  30     """Indicates an error mapping addressable objects."""
  31
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/src/python/pants/base/exceptions.py b/src/python/pants/base/exceptions.py
  --- a/src/python/pants/base/exceptions.py
  +++ b/src/python/pants/base/exceptions.py
  @@ -3,6 +3,11 @@
   
   from __future__ import annotations
   
  +from typing import TYPE_CHECKING
  +
  +if TYPE_CHECKING:
  +    from pants.engine.internals.native_engine import PyFailure
  +
   
   class TargetDefinitionException(Exception):
       """Indicates an invalid target definition.
  @@ -28,3 +33,15 @@
   
   class MappingError(Exception):
       """Indicates an error mapping addressable objects."""
  +
  +
  +class NativeEngineFailure(Exception):
  +    """A wrapper around a `Failure` instance.
  +
  +    TODO: This type is defined in Python because pyo3 doesn't support declaring Exceptions with
  +    additional fields. See https://github.com/PyO3/pyo3/issues/295
  +    """
  +
  +    def __init__(self, msg: str, failure: PyFailure) -> None:
  +        super().__init__(msg)
  +        self.failure = failure
  
verification_info: {"golden_diff": "diff --git a/src/python/pants/base/exceptions.py b/src/python/pants/base/exceptions.py\n--- a/src/python/pants/base/exceptions.py\n+++ b/src/python/pants/base/exceptions.py\n@@ -3,6 +3,11 @@\n \n from __future__ import annotations\n \n+from typing import TYPE_CHECKING\n+\n+if TYPE_CHECKING:\n+    from pants.engine.internals.native_engine import PyFailure\n+\n \n class TargetDefinitionException(Exception):\n     \"\"\"Indicates an invalid target definition.\n@@ -28,3 +33,15 @@\n \n class MappingError(Exception):\n     \"\"\"Indicates an error mapping addressable objects.\"\"\"\n+\n+\n+class NativeEngineFailure(Exception):\n+    \"\"\"A wrapper around a `Failure` instance.\n+\n+    TODO: This type is defined in Python because pyo3 doesn't support declaring Exceptions with\n+    additional fields. See https://github.com/PyO3/pyo3/issues/295\n+    \"\"\"\n+\n+    def __init__(self, msg: str, failure: PyFailure) -> None:\n+        super().__init__(msg)\n+        self.failure = failure\n", "issue": "`./pants run` crashes when `remote_cache_eager_fetch = false`\n**Describe the bug**\r\n\r\nAfter setting `remote_cache_eager_fetch = false`, a CI step that `./pants run`s a `pex_binary` has started (intermittently) failing with errors like:\r\n```\r\n Exception: Was not present in either the local or remote store: Digest { hash: Fingerprint<46683dec8706b7ac7c4f6011f68b4b8c10ad423ae8ba57745a6f5e01ba5b2f7b>, size_bytes: 11827 }\r\n```\r\n\r\n**Pants version**\r\n\r\n`PANTS_SHA=5d8a328d72209863986c8959b20305505bc068ba`\r\n\r\n**OS**\r\n\r\nLinux\r\n\r\n**Additional info**\r\n\r\nSome BuildSense links where we've seen the failure:\r\n* https://app.toolchain.com/organizations/color/repos/color/builds/pants_run_2022_06_27_19_29_46_827_37a3a5f2d8e440cca373a7fb4a5d3b51/\r\n* https://app.toolchain.com/organizations/color/repos/color/builds/pants_run_2022_06_27_19_31_09_277_3793f53b54914135885f2ac951faf210/\r\n* https://app.toolchain.com/organizations/color/repos/color/builds/pants_run_2022_06_27_19_29_46_827_37a3a5f2d8e440cca373a7fb4a5d3b51/\r\n\n", "before_files": [{"content": "# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).\n# Licensed under the Apache License, Version 2.0 (see LICENSE).\n\nfrom __future__ import annotations\n\n\nclass TargetDefinitionException(Exception):\n    \"\"\"Indicates an invalid target definition.\n\n    :API: public\n    \"\"\"\n\n    def __init__(self, target, msg):\n        \"\"\"\n        :param target: the target in question\n        :param string msg: a description of the target misconfiguration\n        \"\"\"\n        super().__init__(f\"Invalid target {target}: {msg}\")\n\n\nclass BuildConfigurationError(Exception):\n    \"\"\"Indicates an error in a pants installation's configuration.\"\"\"\n\n\nclass BackendConfigurationError(BuildConfigurationError):\n    \"\"\"Indicates a plugin backend with a missing or malformed register module.\"\"\"\n\n\nclass MappingError(Exception):\n    \"\"\"Indicates an error mapping addressable objects.\"\"\"\n", "path": "src/python/pants/base/exceptions.py"}], "after_files": [{"content": "# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).\n# Licensed under the Apache License, Version 2.0 (see LICENSE).\n\nfrom __future__ import annotations\n\nfrom typing import TYPE_CHECKING\n\nif TYPE_CHECKING:\n    from pants.engine.internals.native_engine import PyFailure\n\n\nclass TargetDefinitionException(Exception):\n    \"\"\"Indicates an invalid target definition.\n\n    :API: public\n    \"\"\"\n\n    def __init__(self, target, msg):\n        \"\"\"\n        :param target: the target in question\n        :param string msg: a description of the target misconfiguration\n        \"\"\"\n        super().__init__(f\"Invalid target {target}: {msg}\")\n\n\nclass BuildConfigurationError(Exception):\n    \"\"\"Indicates an error in a pants installation's configuration.\"\"\"\n\n\nclass BackendConfigurationError(BuildConfigurationError):\n    \"\"\"Indicates a plugin backend with a missing or malformed register module.\"\"\"\n\n\nclass MappingError(Exception):\n    \"\"\"Indicates an error mapping addressable objects.\"\"\"\n\n\nclass NativeEngineFailure(Exception):\n    \"\"\"A wrapper around a `Failure` instance.\n\n    TODO: This type is defined in Python because pyo3 doesn't support declaring Exceptions with\n    additional fields. See https://github.com/PyO3/pyo3/issues/295\n    \"\"\"\n\n    def __init__(self, msg: str, failure: PyFailure) -> None:\n        super().__init__(msg)\n        self.failure = failure\n", "path": "src/python/pants/base/exceptions.py"}]}