Question about updating dependencies via zig fetch --save

I was curious about Lui: a simple ls -lah-like terminal file manager but it had bug with dependencies (@lukeflo already fixed it :wink: )

$ zig version
0.16.0

I have Zig 0.16.0

$ git clone https://codeberg.org/lukeflo/lui.git
Cloning into 'lui'...
remote: Enumerating objects: 323, done.
remote: Counting objects: 100% (323/323), done.
remote: Compressing objects: 100% (317/317), done.
remote: Total 323 (delta 264), reused 0 (delta 0), pack-reused 0 (from 0)
Receiving objects: 100% (323/323), 88.84 KiB | 1.18 MiB/s, done.
Resolving deltas: 100% (264/264), done.
$ cd lui
$ git checkout --detach 4f282ad5868fd5104d34862e886c888cda292d7e
HEAD is now at 4f282ad update README again

I’d cloned repo and checked out problematic commit

$ cat build.zig.zon
.{
    .name = .lui,
    .version = "0.1.0",
    .fingerprint = 0xd8aabf197916c3cf, // Changing this has security and trust implications.
    .minimum_zig_version = "0.16.0",
    .dependencies = .{
        .lexopts = .{
            .path = "../lexopts",
        },
        .vaxis = .{
            .path = "../libvaxis",
        },
    },
    .paths = .{
        "build.zig",
        "build.zig.zon",
        "src",
    },
}

With dependencies like this zig build would not find them :frowning:

$ zig fetch --save git+https://codeberg.org/lukeflo/lexopts.git
info: resolved to commit 21a4361da6d4ce05ca7e657767740f2a8ea88f77
warning: overwriting existing dependency named 'lexopts'
$ zig fetch --save git+https://github.com/rockorager/libvaxis.git
info: resolved to commit 60a507c25b5335e222eb12320aa7514db684d4a4
warning: overwriting existing dependency named 'vaxis'

I tried to fix dependencies with zig fetch –save

$ cat build.zig.zon
.{
    .name = .lui,
    .version = "0.1.0",
    .fingerprint = 0xd8aabf197916c3cf, // Changing this has security and trust implications.
    .minimum_zig_version = "0.16.0",
    .dependencies = .{
        .lexopts = .{
            .path = "git+https://codeberg.org/lukeflo/lexopts.git#21a4361da6d4ce05ca7e657767740f2a8ea88f77",
        },
        .vaxis = .{
            .path = "git+https://github.com/rockorager/libvaxis.git#60a507c25b5335e222eb12320aa7514db684d4a4",
        },
    },
    .paths = .{
        "build.zig",
        "build.zig.zon",
        "src",
    },
}

…but build.zig.zon did not have expected data.

$ git show main
commit 11e9d6f5f0bbf1a6305339ad5afcd3d9e796e574 (origin/main, origin/HEAD, main)
Author: lukeflo <lukeflo_git@posteo.de>
Date:   Mon May 18 20:47:42 2026 +0200

    add deps via `zig fetch --save`

diff --git a/build.zig.zon b/build.zig.zon
index 12bf85b..82dd86e 100644
--- a/build.zig.zon
+++ b/build.zig.zon
@@ -5,10 +5,12 @@
     .minimum_zig_version = "0.16.0",
     .dependencies = .{
         .lexopts = .{
-            .path = "../lexopts",
+            .url = "git+https://codeberg.org/lukeflo/lexopts.git#21a4361da6d4ce05ca7e657767740f2a8ea88f77",
+            .hash = "lexopts-0.6.0-Zs2TZgNXAAA-KhaectXNnnjzMPLUEB2GqP5dMC04IO0_",
         },
         .vaxis = .{
-            .path = "../libvaxis",
+            .url = "git+https://github.com/rockorager/libvaxis.git#60a507c25b5335e222eb12320aa7514db684d4a4",
+            .hash = "vaxis-0.6.0-BWNV_HHwCQCy33z_jb0RHLjoinqQ8tgQVZI9z2e5Yqdd",
         },
     },
     .paths = .{

Commit fixing that issue show what I expected.

Was I wrong wanting to get pair of .url and .hash instead of .path after running zig fetch --save or it is a bug?

Note: with empty .dependenciesit worked flawlessly, problem lies with updating them.

2 Likes

Yeah its a known bug:

2 Likes

Thanks. I totally forgot about github and looked only at issues at codeberg, and so did not found it reported.