What happened?
tuist install fails to restore Swift packages hosted on git servers that reject shallow fetches — in our case the generated SDKs on buf.build (https://buf.build/gen/swift/git/...).
SwifterPM’s source restore has exactly two strategies (Restore.swift, ensureSource):
downloadSourceArchive — only implemented for GitHub/GitLab, so it throws for any other host, and
shallowFetchCheckout — git fetch --depth=1 origin <revision>.
buf.build’s git server does not support shallow clients (uploadpack.allowShallow off), so step 2 fails with fatal: Server does not support shallow clients and there is no full-fetch fallback. A plain (non-shallow) git fetch origin <revision> of the same pin succeeds against the same server, so a fallback to a full fetch when the server rejects shallow would fix this.
Expected: the restore falls back to a non-shallow fetch (like SwiftPM does) when the server rejects --depth, instead of failing the whole install.
Workaround: TUIST_USE_SWIFTERPM=0 (works fine).
How do we reproduce it?
No auth needed — the package is public. The failing git operation can be reproduced standalone:
mkdir repro && cd repro && git init .
git remote add origin https://buf.build/gen/swift/git/1.24.2-20241219201140-e93e34f48be0.1/googleapis_googleapis_grpc_swift.git
# what SwifterPM runs — fails:
git fetch --depth=1 origin 13244576b21a339b077ed7ef1e029710bcf2ae24
# fatal: Server does not support shallow clients
# same fetch without --depth — succeeds:
git fetch origin 13244576b21a339b077ed7ef1e029710bcf2ae24
Through tuist: add the package to Tuist/Package.swift of any generated project and run tuist install with a cold source cache:
.package(url: "https://buf.build/gen/swift/git/1.24.2-20241219201140-e93e34f48be0.1/googleapis_googleapis_grpc_swift.git", exact: "1.24.2-20241219201140-e93e34f48be0.1")
(Resolution itself succeeds — SwiftPM handles it — only the SwifterPM restore step fails. A warm source cache masks the bug, which is why this surfaced for us only after a version bump left the cache cold for these pins.)
Error log
✖ Error
failed to restore googleapis_googleapis_grpc_swift from https://buf.build/gen/swift/git/1.24.2-20241219201140-e93e34f48be0.1/googleapis_googleapis_grpc_swift.git at 13244576b21a339b077ed7ef1e029710bcf2ae24: could not fetch any candidate location for https://buf.build/gen/swift/git/1.24.2-20241219201140-e93e34f48be0.1/googleapis_googleapis_grpc_swift.git:
- https://buf.build/gen/swift/git/1.24.2-20241219201140-e93e34f48be0.1/googleapis_googleapis_grpc_swift.git: fatal: Server does not support shallow clients
fatal: the remote end hung up unexpectedly
macOS version
26.6.2
Tuist version
4.205.0
Xcode version
26.6