ERROR: expected package `CSV` to exist in the manifest

Hello everyone! I am getting a very strange error when I try to run my Julia program. It looks as follows:

ERROR: expected package `CSV [336ed68f]` to exist in the manifest (use `resolve` to populate the manifest)
Stacktrace:
  [1] pkgerror(::String, ::Vararg{String})
    @ Pkg.Types /scratch1/users/koehne19/patchwork_benchmarking/julia-1.8.2/share/julia/stdlib/v1.8/Pkg/src/Types.jl:67
  [2] package_info
    @ /scratch1/users/koehne19/patchwork_benchmarking/julia-1.8.2/share/julia/stdlib/v1.8/Pkg/src/API.jl:55 [inlined]
  [3] #9
    @ ./none:0 [inlined]
  [4] iterate
    @ ./generator.jl:47 [inlined]
  [5] _all(f::Base.var"#343#345", itr::Base.Generator{Vector{Pkg.Types.PackageSpec}, Pkg.API.var"#9#10"{Pkg.Types.EnvCache}}, #unused#::Colon)
    @ Base ./reduce.jl:1250
  [6] all
    @ ./reduce.jl:1246 [inlined]
  [7] Dict(kv::Base.Generator{Vector{Pkg.Types.PackageSpec}, Pkg.API.var"#9#10"{Pkg.Types.EnvCache}})
    @ Base ./dict.jl:131
  [8] dependencies
    @ /scratch1/users/koehne19/patchwork_benchmarking/julia-1.8.2/share/julia/stdlib/v1.8/Pkg/src/API.jl:85 [inlined]
  [9] dependencies
    @ /scratch1/users/koehne19/patchwork_benchmarking/julia-1.8.2/share/julia/stdlib/v1.8/Pkg/src/API.jl:82 [inlined]
 [10] packageversion(name::String)
    @ Main.Patchwork /scratch/users/koehne19/patchwork_benchmarking/Patchwork/src/alignedregion.jl:851
 [11] slicealignment(region::Main.Patchwork.AlignedRegion, indices::UnitRange{Int64})
    @ Main.Patchwork /scratch/users/koehne19/patchwork_benchmarking/Patchwork/src/alignedregion.jl:400
 [12] merge(a::Main.Patchwork.AlignedRegion, b::Main.Patchwork.AlignedRegion, skipcheck::Bool)
    @ Main.Patchwork /scratch/users/koehne19/patchwork_benchmarking/Patchwork/src/alignedregion.jl:600
 [13] merge
    @ /scratch/users/koehne19/patchwork_benchmarking/Patchwork/src/alignedregion.jl:587 [inlined]
 [14] mergeoverlaps(regions::Main.Patchwork.AlignedRegionCollection, sorted::Bool, iteration::Int64, maxiterate::Int64)
    @ Main.Patchwork /scratch/users/koehne19/patchwork_benchmarking/Patchwork/src/alignedregioncollection.jl:206
 [15] mergeoverlaps
    @ /scratch/users/koehne19/patchwork_benchmarking/Patchwork/src/alignedregioncollection.jl:193 [inlined]
 [16] main()
    @ Main.Patchwork /scratch/users/koehne19/patchwork_benchmarking/Patchwork/src/Patchwork.jl:464
 [17] julia_main()
    @ Main.Patchwork /scratch/users/koehne19/patchwork_benchmarking/Patchwork/src/Patchwork.jl:521
 [18] top-level scope
    @ /scratch/users/koehne19/patchwork_benchmarking/Patchwork/src/Patchwork.jl:531
 [19] include(mod::Module, _path::String)
    @ Base ./Base.jl:419
 [20] exec_options(opts::Base.JLOptions)
    @ Base ./client.jl:303
 [21] _start()
    @ Base ./client.jl:522

The thing is, CSV actually is in the Manifest file, so import Pkg; Pkg.resolve() doesn’t change anything. Also, this error doesn’t happen for all datasets, and not even for the same dataset when running the compiled and uncompiled versions of my program just to check. Thanks for your help!

Please post enough things for people to be able to reproduce. This includes for example the project + manifest and the code you are running.

Sorry, here goes:
The function that produces the error looks as follows:

function packageversion(name::AbstractString)
    dependencies = [entry.second for entry in Pkg.dependencies()]
    match = only(filter(dependency -> dependency.name == name, dependencies))
    versionstring = string(match.version)
    versionnumber = parse(Int64, replace(versionstring, '.' => ""))
    return versionnumber
end

The Project.toml looks like this:

name = "Patchwork"
uuid = "5568df11-beb6-4e3e-8878-8f1e5127fa36"
authors = XXX
version = XXX

[deps]
ArgParse = "c7e460c6-2fb9-53a9-8c5b-16f535851c63"
BioAlignments = "00701ae9-d1dc-5365-b64a-a3a3ebf5695e"
BioCore = "37cfa864-2cd6-5c12-ad9e-b6597d696c81"
BioGenerics = "47718e42-2ac5-11e9-14af-e5595289c2ea"
BioSequences = "7e6ae17a-c86d-528c-b3b9-7f778a29fe59"
BioSymbols = "3c28c6f8-a34d-59c4-9654-267d177fcfa9"
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
CategoricalArrays = "324d7699-5711-5eae-9e2f-1d82baa6b597"
CodecZlib = "944b1d66-785c-5afd-91f1-9de20f533193"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
FASTX = "c2308a5c-f048-11e8-3e8a-31650f418d12"
GFF3 = "af1dc308-cb6b-11e8-32f0-31192efa90f6"
GenomicFeatures = "899a7d2d-5c61-547b-bef9-6698a8d05446"
PackageCompiler = "9b87118b-4619-50d2-8e1e-99f35a4d4d9d"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
PrettyTables = "08abe8d2-0d0c-5749-adfa-8a2ac140af0d"
PyPlot = "d330b81b-6aea-500a-939a-2ce795aea3ee"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
UnicodePlots = "b8865327-cd53-5732-bb35-84acbb429228"
VegaDatasets = "0ae4a718-28b7-58ec-9efb-cded64d6d5b4"
VegaLite = "112f6efa-9a02-5b7d-90c0-432ed331239a"

And the Manifest.toml was simply generated alongside the project file. It’s very long, but CSV is definitely in there:

[[deps.CSV]]
deps = ["CodecZlib", "Dates", "FilePathsBase", "InlineStrings", "Mmap", "Parsers", "PooledArrays", "SentinelArrays", "Tables", "Unicode", "WeakRefStrings"]
git-tree-sha1 = "c5fd7cd27ac4aed0acf4b73948f0110ff2a854b2"
uuid = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
version = "0.10.7"

I hope that will do. It’s strange because the error doesn’t occur the same on all machines, nor for all datasets I tried as input.