Error when running `zig build` and `zig fetch`

I was on a break for some time pre-0.12.0 to 0.13.0, I then stated to revisit and work on my projects from before the break. The project is freigthdb. It was strted pre-0.11. When I run zig build or zig fetch I get this error:

zig build
error: HttpProxyMissingHost

and

zig fetch --save https://github.com/karlseguin/http.zig
error: HttpProxyMissingHost

I don’t really know why and I didn’t get any good result when googling.
My Operating System is nixos 24.11

Try fetching a specific commit:

zig fetch --save https://github.com/karlseguin/http.zig/archive/7080d97.tar.gz

It does not work

Are you on 0.13.0 now?

Yes, I am on zig v0.13

Ok, try deleting the local cache directories, zig-cache/ and .zig-cache/, and building again.

You environment must contain one of: http_proxy, HTTP_PROXY, https_proxy, HTTPS_PROXY, all_proxy, ALL_PROXY and its value is missing the host name or address.

How to do it in nixos? Because I don’t think env variable works in it

I don’t know about the proxy error, but for the fetch I think it is better to use git+https:

zig fetch --save git+https://github.com/karlseguin/http.zig

That will automatically add the commit to the url.

1 Like

Tried it, does not work

That error exists in only one place in the Zig repo, here

Which indicates that it’s a parsing failure.

I have a nasty suspicion that the second occurrence of http in your URI is causing problems here. Can you zig fetch other repos?

Still the same issue:

zig fetch --save git+https://github.com/karlseguin/pg.zig#master
error: HttpProxyMissingHost
1 Like

My host is 127.0.0.1, is that the problem here?

Do you have one of these in your environment?
http_proxy, HTTP_PROXY, https_proxy, HTTPS_PROXY, all_proxy, ALL_PROXY

The value of one of these variables creates the problem.

If 127.0.0.1 is your proxy definition, you also need a protocol and an port: e.g. http://127.0.0.1:8080

The full value is http://127.0.0.1:3128/

This value is fine.

But there must be another one of these:
http_proxy, HTTP_PROXY, https_proxy, HTTPS_PROXY, all_proxy, ALL_PROXY
with a different value, that creates the problem.
Zig looks at all of these. If it cannot parse one of these, it gives the message that you had.

I have

 networking.proxy.httpProxy = "http://127.0.0.1:3128/";
  networking.proxy.httpsProxy = "https://127.0.0.1:3128/";
  networking.proxy.allProxy = "http://127.0.0.1:3128/";

in my configuration.nix

What is your zig version?


Unrelated, but as configured, your proxy server accepts both http and https traffic on port 3128. Is this correct? If your proxy server accepts only http, the correct configuration for networking.proxy.httpsProxy is http://127.0.0.1:3128/.

Latest stable