Repository navigation
Closed
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behaviorstandard libraryThis issue involves writing Zig code for the standard library.This issue involves writing Zig code for the standard library.
Milestone
Description
Zig Version
0.13.0
Steps to Reproduce and Observed Behavior
How to Reproduce?
$ git clone https://github.com/allyourcodebase/boost-libraries-zig
$ cd boost-libraries-zig
$ zig build # optional add --fetchNote
Basically, these are 115 packages that list all the includePaths. However, sources are optionally linked.
zig build --build-file $PWD/tests/build.zig --summary all -freference-trace -Dtarget=native-windows-msvc
D:\a\boost-libraries-zig\boost-libraries-zig/tests\..\build.zig.zon:18:20: error: unable to discover remote git server capabilities: EndOfStream
D:\a\boost-libraries-zig\boost-libraries-zig/tests\..\build.zig.zon:30:20: error: unable to discover remote git server capabilities: EndOfStream
D:\a\boost-libraries-zig\boost-libraries-zig/tests\..\build.zig.zon:38:20: error: unable to discover remote git server capabilities: EndOfStream
D:\a\boost-libraries-zig\boost-libraries-zig/tests\..\build.zig.zon:134:20: error: unable to discover remote git server capabilities: EndOfStream
D:\a\boost-libraries-zig\boost-libraries-zig/tests\..\build.zig.zon:142:20: error: unable to discover remote git server capabilities: EndOfStream
D:\a\boost-libraries-zig\boost-libraries-zig/tests\..\build.zig.zon:150:20: error: unable to discover remote git server capabilities: EndOfStream
D:\a\boost-libraries-zig\boost-libraries-zig/tests\..\build.zig.zon:222:20: error: unable to discover remote git server capabilities: EndOfStream
D:\a\boost-libraries-zig\boost-libraries-zig/tests\..\build.zig.zon:238:20: error: unable to discover remote git server capabilities: EndOfStream
D:\a\boost-libraries-zig\boost-libraries-zig/tests\..\build.zig.zon:262:20: error: unable to discover remote git server capabilities: EndOfStream
Error: Process completed with exit code 1.Reference
Expected Behavior
No issue.
Reacted by Jost Alemann, Neel Sani and Anton-4
Metadata
Metadata
Assignees
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behaviorstandard libraryThis issue involves writing Zig code for the standard library.This issue involves writing Zig code for the standard library.
Activity
zadockmaloba commentedon Oct 4, 2024
Experienced something similar. Happens when fetching nested dependencies.
E.g libpq - has dependencies on openssl, zstd and zlib
When building it as a standalone it fetches its dependencies correctly. But when we add libpq as a dependency in another project it fails to fetch. (on Linux at least, works fine on macOS Sonoma)
I have not looked deep into it but I think the issue comes when the url has git+https prefix
zadockmaloba commentedon Oct 6, 2024
Check on this: git: fatal: Could not read from remote repository
It may actually be an ssh issue and not a zig fetch issue. At least it solved the issue for me
agagniere commentedon Oct 11, 2024
@zadockmaloba I reproduced your issue here (only on Mac for some reason).
I then realised the difference between zstd and the other dependencies:
OK:
Not OK:
Notice the extra
.git!Removing the
.gitsolved the issue : afterianprime0509 commentedon Oct 12, 2024
@zadockmaloba regarding
Zig's git+http(s) fetch support does not use SSH or even the
gitbinary in any way, so any Git SSH configuration will not affect the fetch process for Git dependencies.@agagniere Zig supports fetching both
git+https://github.com/allyourcodebase/zstdandgit+https://github.com/allyourcodebase/zstd.git; runningzig fetchwith both URLs will produce the same output. (This is because GitHub accepts both repository paths without redirecting, not because of any special behavior in Zig)The reason it may seem like certain solutions are working is because this issue is very sporadic and can't be reproduced 100% consistently: even with the GitHub Actions run linked in the issue description, the next attempt of the same run succeeded: https://github.com/allyourcodebase/boost-libraries-zig/actions/runs/10722077115
I tried to investigate this a bit further: I hacked together an ugly patch to get
std.crypto.tls.Clientto write its keys to an SSLKEYLOGFILE so Wireshark would be able to decrypt the TLS traffic, and I ranzig build --fetchon the provided project a few times until it failed to fetch some of the packages. In all three failed package fetches I've reproduced so far, what happened is the initial/info/refsrequest (used to discover Git server capabilities) was sent on a reused connection which the server appears to have already attempted to close, e.g.:I'm not at all knowledgeable when it comes to low-level networking stuff, though, so unfortunately this is as far as my investigation has gotten so far.
ianprime0509 commentedon Oct 12, 2024
I'm not sure how I didn't notice this when I was debugging last night, but the server closing the connection is occurring 30 seconds after the last activity on the connection, so this seems to be a case of the server enforcing an idle timeout on the connection and closing it:
But the connection remains in the pool, and is reused for the next request despite being closed. So, in other words, there needs to be some sort of check when acquiring a connection from the pool to make sure that it's still valid to use (and/or enforce an idle timeout within the pool to proactively evict connections which are likely to be unusable).
arafel commentedon Oct 18, 2024
If it helps anyone, currently I can reproduce this every time:
Distributor ID: Ubuntu
Description: Ubuntu 20.04.6 LTS
Release: 20.04
Codename: focal
(x86_64)
ianprime0509 commentedon Oct 19, 2024
@arafel that is most likely unrelated to the original issue here (
EndOfStreamvsTlsInitializationFailed), especially if you're able to reproduce it every time with a single dependency having no transitive dependencies. My first thought would be to check whether your system CA certificates are properly installed (on Ubuntu, the ca-certificates package): on a fresh Ubuntu 20.04 Docker container, ca-certificates is not installed by default, and I can reproduce your issue, but after installing ca-certificates it works fine. See also #14168 for a proposal which might improve this situation in the future, if that turns out to be your issue.[-]Zig fetch: Unable to discover remote git server capabilities[/-][+]HTTP client connection pool timeouts causing EndOfStream[/+]cztomsik commentedon Aug 12, 2025
I think I am experiencing this too (getting EndOfStream, after the app is running for some time in Zig 0.14.1) but also my main process forks itself into several children and that might be a problem too. I will try to switch back to curl and see if it solves the issue (and report here).
try without .git
Roc platform host shim (#8214)
fix(db): evict poisoned keep-alive connections and retry (ziglang/zig…
Retry libghostty dependency fetches
andrewrk commentedon Oct 11, 2026
https://codeberg.org/ziglang/zig/issues/37195