JLD2 Error: "type DataType has no field mutable"

I’d like to save variables for later. To do this, I installed the JLD2 package. But when I try to save, I get the following error:

Error Details
julia> using JLD2

julia> hello = "world"

julia> foo = :bar

julia> @save "example.jld2" hello foo
ERROR: type DataType has no field mutable
 [1] getproperty
   @ .\Base.jl:37 [inlined]
 [2] ismutabletype(x::DataType)
   @ JLD2 C:\Users\USER\.julia\packages\JLD2\qncOK\src\datasets.jl:538
 [3] write_dataset(f::JLD2.JLDFile{JLD2.MmapIO}, dataspace::JLD2.WriteDataspace{0, Tuple{}}, datatype::JLD2.BasicDatatype, odr::JLD2.FixedLengthString{String}, data::String, wsession::JLD2.JLDWriteSession{Dict{UInt64, JLD2.RelOffset}})
   @ JLD2 C:\Users\USER\.julia\packages\JLD2\qncOK\src\datasets.jl:428
 [4] write_dataset
   @ C:\Users\USER\.julia\packages\JLD2\qncOK\src\datasets.jl:542 [inlined]
 [5] write(g::JLD2.Group{JLD2.JLDFile{JLD2.MmapIO}}, name::String, obj::String, wsession::JLD2.JLDWriteSession{Dict{UInt64, JLD2.RelOffset}})
   @ JLD2 C:\Users\USER\.julia\packages\JLD2\qncOK\src\groups.jl:119
 [6] write(f::JLD2.JLDFile{JLD2.MmapIO}, name::String, obj::String, wsession::JLD2.JLDWriteSession{Dict{UInt64, JLD2.RelOffset}})
   @ JLD2 C:\Users\USER\.julia\packages\JLD2\qncOK\src\JLD2.jl:347
 [7] top-level scope
   @ C:\Users\USER\.julia\packages\JLD2\qncOK\src\loadsave.jl:66

What’s going wrong and what can I do to fix this? Did I do something wrong? Is there a better way to save variables for later?


this is an issue that was fixed quite some time ago.

Can you please try to update JLD2 to the latest version?
What julia version are you using?

1 Like

I’m running

julia> VERSION

I tried pkg> update and pkg> up JLD2, but it didn’t seem to fix my issue. The JLD2 version is

JLD2 v0.4.3
1 Like

Hi @poopsilon ,
ok, then the JLD2 version is definitely the reason you’re seeing the error message.
The latest release of JLD2 is v0.4.22.

Therefore the “real” issue is that something is holding back your versions.
You might try to uninstall JLD2 and reinstall and check if you have “pinned” any versions explicitly.

1 Like

Thanks for your help!

I uninstalled JLD2 and reinstalled v0.4.22 from the github link in this page. Seems to be working now. Not sure how I got the wrong version though…