# \`zig fetch\` unable to connect to server

**URL:** <https://ziggit.dev/t/zig-fetch-unable-to-connect-to-server/7752>\
**Category:** Help\
**Tags:** zig-master, zig-0-13\
**Created:** [January 8, 2025, 10:56am UTC](https://ziggit.dev/t/zig-fetch-unable-to-connect-to-server/7752 "2025-01-08T10:56:45Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![bagggage](https://ziggit.dev/user_avatar/ziggit.dev/bagggage/32/3091_2.png) [@bagggage](https://ziggit.dev/u/bagggage)\
**Post date:** [January 8, 2025, 10:56am UTC](https://ziggit.dev/t/zig-fetch-unable-to-connect-to-server/7752/1 "2025-01-08T10:56:45Z")

</div>

I just was trying to build some random zig project with dependencies defined in `build.zig.zon`. And get this error:

```zig
error: unable to connect to server: TemporaryNameServerFailure

```

I tried using `zig fetch` directly, but as expected it gave the same error.

```zig
zig fetch https://pkg.machengine.org/mach-opus/32712fd091636037959720ee00036a060816a4f0.tar.gz

```

Any other software works absolutely fine: `wget`, `curl`, `google-chrome`… etc.

---

<div class="post-metadata">

**Author:** ![jeffective](https://ziggit.dev/user_avatar/ziggit.dev/jeffective/32/3116_2.png) [@jeffective](https://ziggit.dev/u/jeffective)\
**Post date:** [January 10, 2025, 3:10am UTC](https://ziggit.dev/t/zig-fetch-unable-to-connect-to-server/7752/2 "2025-01-10T03:10:45Z")

</div>

The TLS implementation wasn’t very good in 0.13. have you tried on master?

---

<div class="post-metadata">

**Author:** ![gyozo](https://ziggit.dev/letter_avatar_proxy/v4/letter/g/97f17d/32.png) [@gyozo](https://ziggit.dev/u/gyozo)\
**Post date:** [April 12, 2025, 6:41pm UTC](https://ziggit.dev/t/zig-fetch-unable-to-connect-to-server/7752/3 "2025-04-12T18:41:24Z")

</div>

Hello. I run into the same issue on zig 0.15.  
Is there a way to tell build.zig{,.zon} to use an external downloader (such as curl)?

---

<div class="post-metadata">

**Author:** ![tw4452852](https://ziggit.dev/user_avatar/ziggit.dev/tw4452852/32/3402_2.png) [@tw4452852](https://ziggit.dev/u/tw4452852)\
**Post date:** [April 13, 2025, 10:12am UTC](https://ziggit.dev/t/zig-fetch-unable-to-connect-to-server/7752/4 "2025-04-13T10:12:26Z")

</div>

You could use [add http/socks5 proxy support for package manager · Issue #15048 · ziglang/zig · GitHub](https://github.com/ziglang/zig/issues/15048#issuecomment-2036045833) as a workaround right now.

---

<div class="post-metadata">

**Author:** ![dimdin](https://ziggit.dev/user_avatar/ziggit.dev/dimdin/32/1457_2.png) [@dimdin](https://ziggit.dev/u/dimdin)\
**Post date:** [April 13, 2025, 2:00pm UTC](https://ziggit.dev/t/zig-fetch-unable-to-connect-to-server/7752/5 "2025-04-13T14:00:37Z")

</div>

Hello @gyozo  
Welcome to ziggit 🙂

Are you using linux?  
If yes, which server is listed in your `/etc/resolv.conf`?

Both Windows and posix platforms that link to their C library return `TemporaryNameServerFailure` when there is a temporary failure in DNS; a retry normally solves the problem.  
When zig is running on linux without linking to the C library, it uses /etc/resolv.conf to find out the DNS server and after retrieving back data from the DNS server it might return `TemporaryNameServerFailure`.

---

<div class="post-metadata">

**Author:** ![floooh](https://ziggit.dev/user_avatar/ziggit.dev/floooh/32/2989_2.png) [@floooh](https://ziggit.dev/u/floooh)\
**Post date:** [April 13, 2025, 2:44pm UTC](https://ziggit.dev/t/zig-fetch-unable-to-connect-to-server/7752/6 "2025-04-13T14:44:41Z")

</div>

Check this thread:

> <https://github.com/ziglang/zig/issues/14636>
>
> \### Zig Version
> 
> 0.11.0-dev.1606+3c2a43fdc
> 
> \### Steps to Reproduce and Obser…ved Behavior
> 
> 1. Create a Zig project using either \`zig init-lib\` or \`zig init-exe\`
> 2. Create a build.zig.zon file:
> \`\`\`zig
> .{
> .name = "viisi",
> .description = "A RISC-V hobby computer inspired by old 80s/90s UNIX workstations",
> .version = "0.1.0",
> .dependencies = .{
> .clap = .{
> .url = "https://github.com/Hejsil/zig-clap/archive/272d8e2088b2cae037349fb260dc05ec46bba422.tar.gz",
> },
> },
> }
> \`\`\`
> 3. Run \`zig build\`
> 
> \### Expected Behavior
> 
> It should be able to resolve github.com and download the file.

Specifically my comment here: [error: TemporaryNameServerFailure when using package management on Termux · Issue #14636 · ziglang/zig · GitHub](https://github.com/ziglang/zig/issues/14636#issuecomment-1894254834)

In my case it only happened on Linux, and came down to some weird incompatibility between Ubuntu and my router’s DNS server feature (I think).

After changing the Linux DNS server from my router to Google’s (8.8.8.8 and 8.8.4.4) it started working.

The symptoms in other networking tools (like git) was that there was a 10 second pause (probably some sort of timeout) before a network operation would take place - but only for specific domains.

---

<div class="post-metadata">

**Author:** ![bosoutuhau](https://ziggit.dev/user_avatar/ziggit.dev/bosoutuhau/32/4952_2.png) [@bosoutuhau](https://ziggit.dev/u/bosoutuhau)\
**Post date:** [April 13, 2025, 11:28pm UTC](https://ziggit.dev/t/zig-fetch-unable-to-connect-to-server/7752/7 "2025-04-13T23:28:28Z")

</div>

If you don’t want to bother with zigfetch, try changing your DNS to cloudflare’s or google’s.
