Package KeyError on a remote process

I have been facing some trouble with remote calls on PerfChecker.jl#alloc

I can’t find the origin of the KeyError (as it is the key in Project.toml). Any idea? The code is from the test in runtests.jl

PerfChecker.jl: Error During Test at C:\Users\jeanf\.julia\dev\PerfChecker\test\runtests.jl:7
  Got exception outside of a @test
  On worker 2:
  KeyError: key PerfChecker [6309bf6b-a531-4b08-891e-8ee981e5c424] not found
  Stacktrace:
    [1] getindex
      @ .\dict.jl:481 [inlined]
    [2] root_module
      @ .\loading.jl:1056 [inlined]
    [3] deserialize_module
      @ C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.7\Serialization\src\Serialization.jl:981
    [4] handle_deserialize
      @ C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.7\Serialization\src\Serialization.jl:883
    [5] deserialize
      @ C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.7\Serialization\src\Serialization.jl:801
    [6] deserialize_datatype
      @ C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.7\Serialization\src\Serialization.jl:1331
    [7] handle_deserialize
      @ C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.7\Serialization\src\Serialization.jl:854
    [8] deserialize
      @ C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.7\Serialization\src\Serialization.jl:801
    [9] handle_deserialize
      @ C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.7\Serialization\src\Serialization.jl:861
   [10] deserialize
      @ C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.7\Serialization\src\Serialization.jl:801 [inlined]
   [11] deserialize_msg
      @ C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.7\Distributed\src\messages.jl:87
   [12] #invokelatest#2
      @ .\essentials.jl:716 [inlined]
   [13] invokelatest
      @ .\essentials.jl:714 [inlined]
   [14] message_handler_loop
      @ C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.7\Distributed\src\process_messages.jl:169
   [15] process_tcp_streams
      @ C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.7\Distributed\src\process_messages.jl:126
   [16] #99
      @ .\task.jl:411
  Stacktrace:
    [1] remotecall_wait(f::Function, w::Distributed.Worker, args::Expr; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}) 
      @ Distributed C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.7\Distributed\src\remotecall.jl:436
    [2] remotecall_wait(f::Function, w::Distributed.Worker, args::Expr)
      @ Distributed C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.7\Distributed\src\remotecall.jl:427
    [3] remotecall_wait(f::Function, id::Int64, args::Expr; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
      @ Distributed C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.7\Distributed\src\remotecall.jl:448
    [4] remotecall_wait
      @ C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.7\Distributed\src\remotecall.jl:448 [inlined]
    [5] alloc_set(title::String, targets::Vector{Module}, ex_pre::Expr, ex_checker::Expr)
      @ PerfChecker C:\Users\jeanf\.julia\dev\PerfChecker\src\alloc.jl:21
    [6] macro expansion
      @ C:\Users\jeanf\.julia\dev\PerfChecker\test\runtests.jl:21 [inlined]
    [7] macro expansion
      @ C:\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.7\Test\src\Test.jl:1282 [inlined]
    [8] top-level scope
      @ C:\Users\jeanf\.julia\dev\PerfChecker\test\runtests.jl:8
    [9] include(fname::String)
      @ Base.MainInclude .\client.jl:451
   [10] top-level scope
      @ none:6
   [11] eval
      @ .\boot.jl:373 [inlined]
   [12] exec_options(opts::Base.JLOptions)
      @ Base .\client.jl:268
   [13] _start()
      @ Base .\client.jl:495
p = first(addprocs(1; exeflags=["--track-allocation=user", "--project"]))

It’s possible that your new worker process doesn’t have the same working directory as your original julia process (especially since tests run in their own environment as far as I know).

That would make sense. At least it gives me some idea to look at!

As for the test environment, it might be the case, but the problem also occurs if I test it in other environment.
Now, I need to find out how to get the environment in the remote worker … or just clone the repo on the fly ><

There is something I am missing here.

      From worker 18:     Activating project at `C:\Users\jeanf\test\cbls`
nothing
Pkg.API.ProjectInfo(nothing, nothing, nothing, false, Dict{String, Base.UUID}("PerfChecker" => UUID("6309bf6b-a531-4b08-891e-8ee981e5c424"), "CompositionalNetworks" => UUID("4b67e4b5-442d-4ef5-b760-3f5df3a57537"), "ConstraintDomains" => UUID("5800fd60-8556-4464-8d61-84ebf7a0bedb")), "C:\\Users\\jeanf\\test\\cbls\\Project.toml")
ERROR: On worker 18:
KeyError: key PerfChecker [6309bf6b-a531-4b08-891e-8ee981e5c424] not found

I have the correct path, the project is activated, and the UUID is precisely what it should be. Any further idea of how I could get more clues?