We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
`Failed to write to remote cache` when running `ruff`
**Describe the bug**

When running `pants lint --only=ruff ::` I see many `WARN` logs like:
```
14:18:48.60 [WARN] Failed to write to remote cache (1 occurrences so far): Declared output directory path RelativePath("src/django_apps/preventive_care/consults/automatic_refer_out/__init__.py") in output digest Digest { hash: Fingerprint<b4c4a7e44c3d23b8eac247bfdd5ed723d054947915bbfb808e0ee16e4fa75430>, size_bytes: 77 } contained a file instead.
```

**Pants version**

`PANTS_SHA=254f69b3f111fb620206bbfe72b262520849484f` (on the 2.16.x branch)

**OS**

MacOS

--- 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/backend/python/lint/ruff/rules.py`
Content:
```
1 # Copyright 2023 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 from pants.backend.python.lint.ruff.subsystem import Ruff, RuffFieldSet
7 from pants.backend.python.util_rules import pex
8 from pants.backend.python.util_rules.pex import PexRequest, VenvPex, VenvPexProcess
9 from pants.core.goals.fix import FixResult, FixTargetsRequest
10 from pants.core.util_rules.config_files import ConfigFiles, ConfigFilesRequest
11 from pants.core.util_rules.partitions import PartitionerType
12 from pants.engine.fs import Digest, MergeDigests
13 from pants.engine.process import FallibleProcessResult
14 from pants.engine.rules import Get, MultiGet, collect_rules, rule
15 from pants.util.logging import LogLevel
16 from pants.util.strutil import pluralize
17 
18 
19 class RuffRequest(FixTargetsRequest):
20     field_set_type = RuffFieldSet
21     tool_subsystem = Ruff
22     partitioner_type = PartitionerType.DEFAULT_SINGLE_PARTITION
23 
24 
25 @rule(desc="Fix with ruff", level=LogLevel.DEBUG)
26 async def ruff_fix(request: RuffRequest.Batch, ruff: Ruff) -> FixResult:
27     ruff_pex_get = Get(VenvPex, PexRequest, ruff.to_pex_request())
28 
29     config_files_get = Get(
30         ConfigFiles, ConfigFilesRequest, ruff.config_request(request.snapshot.dirs)
31     )
32 
33     ruff_pex, config_files = await MultiGet(ruff_pex_get, config_files_get)
34 
35     input_digest = await Get(
36         Digest,
37         MergeDigests((request.snapshot.digest, config_files.snapshot.digest)),
38     )
39 
40     conf_args = [f"--config={ruff.config}"] if ruff.config else []
41 
42     result = await Get(
43         FallibleProcessResult,
44         VenvPexProcess(
45             ruff_pex,
46             argv=("--fix", *conf_args, *ruff.args, *request.files),
47             input_digest=input_digest,
48             output_directories=request.files,
49             description=f"Run ruff on {pluralize(len(request.elements), 'file')}.",
50             level=LogLevel.DEBUG,
51         ),
52     )
53     return await FixResult.create(request, result, strip_chroot_path=True)
54 
55 
56 def rules():
57     return [*collect_rules(), *RuffRequest.rules(), *pex.rules()]
58
```
--- 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()

```

diff --git a/src/python/pants/backend/python/lint/ruff/rules.py b/src/python/pants/backend/python/lint/ruff/rules.py
--- a/src/python/pants/backend/python/lint/ruff/rules.py
+++ b/src/python/pants/backend/python/lint/ruff/rules.py
@@ -45,7 +45,7 @@
             ruff_pex,
             argv=("--fix", *conf_args, *ruff.args, *request.files),
             input_digest=input_digest,
-            output_directories=request.files,
+            output_files=request.files,
             description=f"Run ruff on {pluralize(len(request.elements), 'file')}.",
             level=LogLevel.DEBUG,
         ),

{"golden_diff": "diff --git a/src/python/pants/backend/python/lint/ruff/rules.py b/src/python/pants/backend/python/lint/ruff/rules.py\n--- a/src/python/pants/backend/python/lint/ruff/rules.py\n+++ b/src/python/pants/backend/python/lint/ruff/rules.py\n@@ -45,7 +45,7 @@\n             ruff_pex,\n             argv=(\"--fix\", *conf_args, *ruff.args, *request.files),\n             input_digest=input_digest,\n-            output_directories=request.files,\n+            output_files=request.files,\n             description=f\"Run ruff on {pluralize(len(request.elements), 'file')}.\",\n             level=LogLevel.DEBUG,\n         ),\n", "issue": "`Failed to write to remote cache` when running `ruff`\n**Describe the bug**\r\n\r\nWhen running `pants lint --only=ruff ::` I see many `WARN` logs like:\r\n```\r\n14:18:48.60 [WARN] Failed to write to remote cache (1 occurrences so far): Declared output directory path RelativePath(\"src/django_apps/preventive_care/consults/automatic_refer_out/__init__.py\") in output digest Digest { hash: Fingerprint<b4c4a7e44c3d23b8eac247bfdd5ed723d054947915bbfb808e0ee16e4fa75430>, size_bytes: 77 } contained a file instead.\r\n```\r\n\r\n**Pants version**\r\n\r\n`PANTS_SHA=254f69b3f111fb620206bbfe72b262520849484f` (on the 2.16.x branch)\r\n\r\n**OS**\r\n\r\nMacOS\n", "before_files": [{"content": "# Copyright 2023 Pants project contributors (see CONTRIBUTORS.md).\n# Licensed under the Apache License, Version 2.0 (see LICENSE).\n\nfrom __future__ import annotations\n\nfrom pants.backend.python.lint.ruff.subsystem import Ruff, RuffFieldSet\nfrom pants.backend.python.util_rules import pex\nfrom pants.backend.python.util_rules.pex import PexRequest, VenvPex, VenvPexProcess\nfrom pants.core.goals.fix import FixResult, FixTargetsRequest\nfrom pants.core.util_rules.config_files import ConfigFiles, ConfigFilesRequest\nfrom pants.core.util_rules.partitions import PartitionerType\nfrom pants.engine.fs import Digest, MergeDigests\nfrom pants.engine.process import FallibleProcessResult\nfrom pants.engine.rules import Get, MultiGet, collect_rules, rule\nfrom pants.util.logging import LogLevel\nfrom pants.util.strutil import pluralize\n\n\nclass RuffRequest(FixTargetsRequest):\n    field_set_type = RuffFieldSet\n    tool_subsystem = Ruff\n    partitioner_type = PartitionerType.DEFAULT_SINGLE_PARTITION\n\n\n@rule(desc=\"Fix with ruff\", level=LogLevel.DEBUG)\nasync def ruff_fix(request: RuffRequest.Batch, ruff: Ruff) -> FixResult:\n    ruff_pex_get = Get(VenvPex, PexRequest, ruff.to_pex_request())\n\n    config_files_get = Get(\n        ConfigFiles, ConfigFilesRequest, ruff.config_request(request.snapshot.dirs)\n    )\n\n    ruff_pex, config_files = await MultiGet(ruff_pex_get, config_files_get)\n\n    input_digest = await Get(\n        Digest,\n        MergeDigests((request.snapshot.digest, config_files.snapshot.digest)),\n    )\n\n    conf_args = [f\"--config={ruff.config}\"] if ruff.config else []\n\n    result = await Get(\n        FallibleProcessResult,\n        VenvPexProcess(\n            ruff_pex,\n            argv=(\"--fix\", *conf_args, *ruff.args, *request.files),\n            input_digest=input_digest,\n            output_directories=request.files,\n            description=f\"Run ruff on {pluralize(len(request.elements), 'file')}.\",\n            level=LogLevel.DEBUG,\n        ),\n    )\n    return await FixResult.create(request, result, strip_chroot_path=True)\n\n\ndef rules():\n    return [*collect_rules(), *RuffRequest.rules(), *pex.rules()]\n", "path": "src/python/pants/backend/python/lint/ruff/rules.py"}], "after_files": [{"content": "# Copyright 2023 Pants project contributors (see CONTRIBUTORS.md).\n# Licensed under the Apache License, Version 2.0 (see LICENSE).\n\nfrom __future__ import annotations\n\nfrom pants.backend.python.lint.ruff.subsystem import Ruff, RuffFieldSet\nfrom pants.backend.python.util_rules import pex\nfrom pants.backend.python.util_rules.pex import PexRequest, VenvPex, VenvPexProcess\nfrom pants.core.goals.fix import FixResult, FixTargetsRequest\nfrom pants.core.util_rules.config_files import ConfigFiles, ConfigFilesRequest\nfrom pants.core.util_rules.partitions import PartitionerType\nfrom pants.engine.fs import Digest, MergeDigests\nfrom pants.engine.process import FallibleProcessResult\nfrom pants.engine.rules import Get, MultiGet, collect_rules, rule\nfrom pants.util.logging import LogLevel\nfrom pants.util.strutil import pluralize\n\n\nclass RuffRequest(FixTargetsRequest):\n    field_set_type = RuffFieldSet\n    tool_subsystem = Ruff\n    partitioner_type = PartitionerType.DEFAULT_SINGLE_PARTITION\n\n\n@rule(desc=\"Fix with ruff\", level=LogLevel.DEBUG)\nasync def ruff_fix(request: RuffRequest.Batch, ruff: Ruff) -> FixResult:\n    ruff_pex_get = Get(VenvPex, PexRequest, ruff.to_pex_request())\n\n    config_files_get = Get(\n        ConfigFiles, ConfigFilesRequest, ruff.config_request(request.snapshot.dirs)\n    )\n\n    ruff_pex, config_files = await MultiGet(ruff_pex_get, config_files_get)\n\n    input_digest = await Get(\n        Digest,\n        MergeDigests((request.snapshot.digest, config_files.snapshot.digest)),\n    )\n\n    conf_args = [f\"--config={ruff.config}\"] if ruff.config else []\n\n    result = await Get(\n        FallibleProcessResult,\n        VenvPexProcess(\n            ruff_pex,\n            argv=(\"--fix\", *conf_args, *ruff.args, *request.files),\n            input_digest=input_digest,\n            output_files=request.files,\n            description=f\"Run ruff on {pluralize(len(request.elements), 'file')}.\",\n            level=LogLevel.DEBUG,\n        ),\n    )\n    return await FixResult.create(request, result, strip_chroot_path=True)\n\n\ndef rules():\n    return [*collect_rules(), *RuffRequest.rules(), *pex.rules()]\n", "path": "src/python/pants/backend/python/lint/ruff/rules.py"}]}