After upgrading to 1.6 adding any package results in (non-breaking) MethodError

I upgraded to 1.6, and from that moment on I got the following error when adding a package. However, the package just seems to be installed, and works fine.

ERROR: MethodError: Cannot `convert` an object of type 
  Nothing to an object of type 
  Union{Pkg.Types.UpgradeLevel, VersionNumber, Pkg.Types.VersionSpec}

I created a new environment to demonstrate using Plots, but the same happens with the few other packages I tried. Here is the stack trace. I didn’t post the entire Manifest.toml, but I can if it helps.

(@v1.6) pkg> activate .
  Activating new environment at `~/some/path/test/Project.toml`

(test) pkg> add Plots
    Updating registry at `~/.julia/registries/General`
   Resolving package versions...
Updating `~/some/path/test/Project.toml`
  [91a5bcdd] + Plots v1.11.0
Updating `~/some/path/test/Manifest.toml`
  [79e6a3ab] + Adapt v3.2.0
  ...
  [8e850ede] + nghttp2_jll
ERROR: MethodError: Cannot `convert` an object of type 
  Nothing to an object of type 
  Union{Pkg.Types.UpgradeLevel, VersionNumber, Pkg.Types.VersionSpec}
Closest candidates are:
  convert(::Type{T}, ::T) where T at essentials.jl:205
Stacktrace:
  [1] Pkg.Types.PackageSpec(name::String, uuid::Base.UUID, version::Nothing, tree_hash::Nothing, repo::Pkg.Types.GitRepo, path::Nothing, pinned::Bool, mode::Pkg.Types.PackageMode)
    @ Pkg.Types /opt/julia/usr/share/julia/stdlib/v1.6/Pkg/src/Types.jl:77
  [2] Pkg.Types.PackageSpec(; name::String, uuid::Base.UUID, version::Nothing, tree_hash::Nothing, repo::Pkg.Types.GitRepo, path::Nothing, pinned::Bool, mode::Pkg.Types.PackageMode)
    @ Pkg.Types ./util.jl:450
  [3] precompile(ctx::Pkg.Types.Context; internal_call::Bool, kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Pkg.API /opt/julia/usr/share/julia/stdlib/v1.6/Pkg/src/API.jl:951
  [4] _auto_precompile(ctx::Pkg.Types.Context)
    @ Pkg.API /opt/julia/usr/share/julia/stdlib/v1.6/Pkg/src/API.jl:902
  [5] add(pkgs::Vector{Pkg.Types.PackageSpec}; kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Pkg.API /opt/julia/usr/share/julia/stdlib/v1.6/Pkg/src/API.jl:74
  [6] add(pkgs::Vector{Pkg.Types.PackageSpec})
    @ Pkg.API /opt/julia/usr/share/julia/stdlib/v1.6/Pkg/src/API.jl:72
  [7] do_cmd!(command::Pkg.REPLMode.Command, repl::REPL.LineEditREPL)
    @ Pkg.REPLMode /opt/julia/usr/share/julia/stdlib/v1.6/Pkg/src/REPLMode/REPLMode.jl:408
  [8] do_cmd(repl::REPL.LineEditREPL, input::String; do_rethrow::Bool)
    @ Pkg.REPLMode /opt/julia/usr/share/julia/stdlib/v1.6/Pkg/src/REPLMode/REPLMode.jl:386
  [9] do_cmd
    @ /opt/julia/usr/share/julia/stdlib/v1.6/Pkg/src/REPLMode/REPLMode.jl:377 [inlined]
 [10] (::Pkg.REPLMode.var"#24#27"{REPL.LineEditREPL, REPL.LineEdit.Prompt})(s::REPL.LineEdit.MIState, buf::IOBuffer, ok::Bool)
    @ Pkg.REPLMode /opt/julia/usr/share/julia/stdlib/v1.6/Pkg/src/REPLMode/REPLMode.jl:550
 [11] #invokelatest#2
    @ ./essentials.jl:708 [inlined]
 [12] invokelatest
    @ ./essentials.jl:706 [inlined]
 [13] run_interface(terminal::REPL.Terminals.TextTerminal, m::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
    @ REPL.LineEdit /opt/julia/usr/share/julia/stdlib/v1.6/REPL/src/LineEdit.jl:2441
 [14] run_frontend(repl::REPL.LineEditREPL, backend::REPL.REPLBackendRef)
    @ REPL /opt/julia/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:1126
 [15] (::REPL.var"#44#49"{REPL.LineEditREPL, REPL.REPLBackendRef})()
    @ REPL ./task.jl:406
(test) pkg> 
julia> using Plots
[ Info: Precompiling Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80]

julia> plot([1,2,3], [1,2,3])
# works fine

Does anybody have an idea what causes this? Is it a bug I should report or is it something that I did do wrong.

Not sure if this is relevant, but I installed Julia 1.6 by make-ing my local clone of the Julia git Repo.

cd /opt/julia
git fetch
git checkout v1.6.0
make
julia> VERSION
v"1.6.0"

Edit

I get the same error when adding an package already in the *.toml files.

pkg> add Plots
   Resolving package versions...
No Changes to `~/some/path/test/Project.toml`
No Changes to `~/some/path/test/Manifest.toml`
ERROR: MethodError: Cannot `convert` an object of type 
  Nothing to an object of type 
  Union{Pkg.Types.UpgradeLevel, VersionNumber, Pkg.Types.VersionSpec}
...
1 Like