Skip to content

Error when freeing dev'd package: Cannot convert VersionSpec to VersionNumber #4554

@jakobnissen

Description

@jakobnissen

Unfortunately I cannot reproduce this error - but I paste the stacktrace here in case the issue is easy to identify, even without a reproducer.
This occurs on Julia 1.13-alpha, when free'ing a dev'd dependency.

I fixed it by removing the Manifest, and only afterwards realized that I should file this error as an issue.

(AoC2025) pkg> free StringViews
   Resolving package versions...
ERROR: MethodError: Cannot `convert` an object of type Pkg.Versions.VersionSpec to an object of type VersionNumber
The function `convert` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  convert(::Type{T}, ::T) where T
   @ Base Base_compiler.jl:136

Stacktrace:
  [1] convert(::Type{Union{Nothing, VersionNumber}}, x::Pkg.Versions.VersionSpec)
    @ Base ./some.jl:35
  [2] Pkg.Types.PackageEntry(name::String, version::Pkg.Versions.VersionSpec, path::Nothing, entryfile::Nothing, pinned::Bool, repo::Pkg.Types.GitRepo, tree_hash::Nothing, deps::Dict{String, Base.UUID}, weakdeps::Dict{String, Base.UUID}, exts::Dict{String, String}, uuid::Base.UUID, apps::Dict{String, Pkg.Types.AppInfo}, registries::Vector{String}, other::Nothing)
    @ Pkg.Types ~/.julia/juliaup/julia-1.13.0-alpha2+0.x64.linux.gnu/share/julia/stdlib/v1.13/Pkg/src/Types.jl:282
  [3] Pkg.Types.PackageEntry(; name::String, version::Pkg.Versions.VersionSpec, path::Nothing, entryfile::Nothing, pinned::Bool, repo::Pkg.Types.GitRepo, tree_hash::Nothing, deps::Dict{String, Base.UUID}, weakdeps::Dict{String, Base.UUID}, exts::Dict{String, String}, uuid::Base.UUID, apps::Dict{String, Pkg.Types.AppInfo}, registries::Vector{String}, other::Nothing)
    @ Pkg.Types ~/.julia/juliaup/julia-1.13.0-alpha2+0.x64.linux.gnu/share/julia/stdlib/v1.13/Pkg/src/Types.jl:281
  [4] kwcall(::@NamedTuple{name::String, version::Pkg.Versions.VersionSpec, pinned::Bool, tree_hash::Nothing, path::Nothing, repo::Pkg.Types.GitRepo, uuid::Base.UUID}, ::Type{Pkg.Types.PackageEntry})
    @ Pkg.Types ~/.julia/juliaup/julia-1.13.0-alpha2+0.x64.linux.gnu/share/julia/stdlib/v1.13/Pkg/src/Types.jl:281
  [5] update_manifest!(env::Pkg.Types.EnvCache, pkgs::Vector{Pkg.Types.PackageSpec}, deps_map::Dict{Base.UUID, Dict{String, Base.UUID}}, julia_version::VersionNumber, registries::Vector{Pkg.Registry.RegistryInstance})
    @ Pkg.Operations ~/.julia/juliaup/julia-1.13.0-alpha2+0.x64.linux.gnu/share/julia/stdlib/v1.13/Pkg/src/Operations.jl:347
  [6] free(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}; err_if_free::Bool)
    @ Pkg.Operations ~/.julia/juliaup/julia-1.13.0-alpha2+0.x64.linux.gnu/share/julia/stdlib/v1.13/Pkg/src/Operations.jl:2561
  [7] free
    @ ~/.julia/juliaup/julia-1.13.0-alpha2+0.x64.linux.gnu/share/julia/stdlib/v1.13/Pkg/src/Operations.jl:2547 [inlined]
  [8] free(ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec}; all_pkgs::Bool, kwargs::@Kwargs{io::IOContext{IO}})
    @ Pkg.API ~/.julia/juliaup/julia-1.13.0-alpha2+0.x64.linux.gnu/share/julia/stdlib/v1.13/Pkg/src/API.jl:544
  [9] kwcall(::@NamedTuple{io::IOContext{IO}}, ::typeof(Pkg.API.free), ctx::Pkg.Types.Context, pkgs::Vector{Pkg.Types.PackageSpec})
    @ Pkg.API ~/.julia/juliaup/julia-1.13.0-alpha2+0.x64.linux.gnu/share/julia/stdlib/v1.13/Pkg/src/API.jl:517
 [10] free(pkgs::Vector{Pkg.Types.PackageSpec}; io::IOContext{IO}, kwargs::@Kwargs{})
    @ Pkg.API ~/.julia/juliaup/julia-1.13.0-alpha2+0.x64.linux.gnu/share/julia/stdlib/v1.13/Pkg/src/API.jl:172
 [11] free(pkgs::Vector{Pkg.Types.PackageSpec})
    @ Pkg.API ~/.julia/juliaup/julia-1.13.0-alpha2+0.x64.linux.gnu/share/julia/stdlib/v1.13/Pkg/src/API.jl:161
 [12] do_cmd(command::Pkg.REPLMode.Command, io::Base.TTY)
    @ Pkg.REPLMode ~/.julia/juliaup/julia-1.13.0-alpha2+0.x64.linux.gnu/share/julia/stdlib/v1.13/Pkg/src/REPLMode/REPLMode.jl:422
 [13] do_cmds(commands::Vector{Pkg.REPLMode.Command}, io::Base.TTY)
    @ Pkg.REPLMode ~/.julia/juliaup/julia-1.13.0-alpha2+0.x64.linux.gnu/share/julia/stdlib/v1.13/Pkg/src/REPLMode/REPLMode.jl:406
 [14] do_cmds(repl::REPL.LineEditREPL, commands::String)
    @ REPLExt ~/.julia/juliaup/julia-1.13.0-alpha2+0.x64.linux.gnu/share/julia/stdlib/v1.13/Pkg/ext/REPLExt/REPLExt.jl:125
 [15] on_done(s::REPL.LineEdit.MIState, buf::IOBuffer, ok::Bool, repl::REPL.LineEditREPL)
    @ REPLExt ~/.julia/juliaup/julia-1.13.0-alpha2+0.x64.linux.gnu/share/julia/stdlib/v1.13/Pkg/ext/REPLExt/REPLExt.jl:139
 [16] #invokelatest_gr#224
    @ ./reflection.jl:1348 [inlined]
 [17] invokelatest_gr
    @ ./reflection.jl:1342 [inlined]
 [18] (::REPLExt.var"#create_mode##0#create_mode##1"{REPL.LineEditREPL})(s::REPL.LineEdit.MIState, buf::IOBuffer, ok::Bool)
    @ REPLExt ~/.julia/juliaup/julia-1.13.0-alpha2+0.x64.linux.gnu/share/julia/stdlib/v1.13/Pkg/ext/REPLExt/REPLExt.jl:165
 [19] run_interface(terminal::Base.Terminals.TextTerminal, m::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
    @ REPL.LineEdit ~/.julia/juliaup/julia-1.13.0-alpha2+0.x64.linux.gnu/share/julia/stdlib/v1.13/REPL/src/LineEdit.jl:2891
 [20] run_frontend(repl::REPL.LineEditREPL, backend::REPL.REPLBackendRef)
    @ REPL ~/.julia/juliaup/julia-1.13.0-alpha2+0.x64.linux.gnu/share/julia/stdlib/v1.13/REPL/src/REPL.jl:1667
 [21] (::REPL.var"#61#62"{REPL.LineEditREPL, REPL.REPLBackendRef})()
    @ REPL ~/.julia/juliaup/julia-1.13.0-alpha2+0.x64.linux.gnu/share/julia/stdlib/v1.13/REPL/src/REPL.jl:687

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions