Stream: bugs

Topic: Package cache directory resolution bug


view this post on Zulip Ian McLerran (Jul 21 2025 at 18:43):

This is a rust compiler bug, so not something anyone should put any time into solving, but I just encountered a bug with package cache directory resolution:

I have an app which imports the v0.1.7 of a particular package. However, despite this directory being already downloaded and present in my cache, when I attempt to compile, it tells me the module I am looking for is not available, and reports using the path for v0.1.0, instead of the one for v0.1.7.

Here is my header:

app [main!] {
    cli: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br",
    # ... other package imports
    rtils: "https://github.com/imclerran/rtils/releases/download/v0.1.7/xGdIJGyOChqLXjqx99Iqunxz3XyEpBp5zGOdb3OVUhs.tar.br",
}
import rtils.Compare

And here is the error message reported:

── FILE NOT FOUND in ...lQteKwQcjXWC51T52AuLGbORPRb9aPRSUUjdwSpHdA/Compare.roc ─

I am looking for this file, but it's not there:

    /Users/imclerran/.cache/roc/packages/github.com/imclerran/rtils/releases/download/v0.1.0/MlQteKwQcjXWC51T52AuLGbORPRb9aPRSUUjdwSpHdA/Compare.roc

Is the file supposed to be there? Maybe there is a typo in the file
name?

Just thought this was interesting. By the way, here is the contents of
/Users/imclerran/.cache/roc/packages/github.com/imclerran/rtils/releases/download:

v0.1.0, v0.1.1, v0.1.2, v0.1.3 v0.1.4, v0.1.5, v0.1.7

view this post on Zulip Ian McLerran (Jul 21 2025 at 18:46):

Oh, also, after removing the v0.1.0 directory from my cache, roc downloads the v0.1.0 again:

Downloading https://github.com/imclerran/rtils/releases/download/v0.1.0/MlQteKwQcjXWC51T52AuLGbORPRb9aPRSUUjdwSpHdA.tar.br
    into /Users/imclerran/.cache/roc/packages

view this post on Zulip Ian McLerran (Jul 21 2025 at 18:47):

This is pretty mystifying, since the url is completely different, in both the version tag, and the hash...

view this post on Zulip Ian McLerran (Jul 21 2025 at 19:06):

Okay, I've got a minimal repro:

app [main!] {
    cli: platform "https://github.com/roc-lang/basic-cli/releases/download/0.19.0/Hj-J_zxz7V9YurCSTFcFdu6cQJie4guzsPMUi5kBYUk.tar.br",
    dt: "https://github.com/imclerran/roc-isodate/releases/download/v0.7.4/bEDedspHQApTvZI2GJfgXpzUmYO_ATw5d6xE_w1qcME.tar.br",
    rtils: "https://github.com/imclerran/rtils/releases/download/v0.1.7/xGdIJGyOChqLXjqx99Iqunxz3XyEpBp5zGOdb3OVUhs.tar.br",
}

import rtils.Compare
import cli.Stdout

main! = |_args|
    Stdout.line!("Hello, World!")

The issue is that roc-isodate depends on rtils v0.1.0, while this app depends on v0.1.7. because they are using the same identifier, there is a collision resulting in the incorrect package version being used.

view this post on Zulip Ian McLerran (Jul 21 2025 at 19:55):

Arguably not a bug, but maybe a better error message could be given, indicating that there is an identifier conflict within a dependency?

view this post on Zulip Anton (Jul 22 2025 at 14:39):

I'm looking at this now @Ian McLerran

view this post on Zulip Anton (Jul 22 2025 at 18:10):

Alright, I was able to detect the situation and throw an error, now I just need to thread my error through nicely and report it like we usually do.

view this post on Zulip Anton (Jul 23 2025 at 13:21):

Fix in PR#8095 :)


Last updated: Jul 26 2025 at 12:14 UTC