# Warning: type does not exist in workspace; reconstructing

**URL:** <https://discourse.julialang.org/t/warning-type-does-not-exist-in-workspace-reconstructing/78232>\
**Category:** General Usage\
**Tags:** question, jld2\
**Created:** [March 21, 2022, 6:59pm UTC](https://discourse.julialang.org/t/warning-type-does-not-exist-in-workspace-reconstructing/78232 "2022-03-21T18:59:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Amro](https://avatars.discourse-cdn.com/v4/letter/a/4491bb/32.png) [@Amro](https://discourse.julialang.org/u/Amro)\
**Post date:** [March 21, 2022, 6:59pm UTC](https://discourse.julialang.org/t/warning-type-does-not-exist-in-workspace-reconstructing/78232/1 "2022-03-21T18:59:30Z")

</div>

I was using the below code to create `.jld2` file containing an instance `Sim` of structure `Simulation`

```julia
include("./SimulationStructure.jl");
function appFunction()
Sim = Simulation();
io = open("$(@ __DIR__ )/generatedElements.jld2", "w")
close(io)
save("$(@ __DIR__ )/generatedElements.jld2", "Sim", Sim)
end
appFunction();

```

in which `SimulationStructure.jl`:

```julia
using base
export Simulation 
Base.@kwdef mutable struct Simulation 
    dt::Float64 = 1e-6
    tmax::Float64 = 32*1e-3
end

```

Then, I was reading the created `.jld2` by the below code called `readFile.jl`. and It was working without any warning, in which typeof `Sim` is `Simulation`

```julia
include("./SimulationStructure.jl");
Sim = load("$(@ __DIR__ )/generatedElements.jld2", "Sim");
julia> typeof(Sim)
Simulation

```

Now, I have built executable for `appFunction()` as below and it works fine to generate the `.jld2` file.

```julia
module readApp

Base.@ccallable function julia_main()::Cint
    try
        appFunction()
    catch
        Base.invokelatest(Base.display_error, Base.catch_stack())
        return 1
    end
    return 0
end

Base.@kwdef mutable struct Simulation 
  dt::Float64 = 1e-6
  tmax::Float64 = 32*1e-3
end

function appFunction()
Sim = Simulation();
io = open("$(@ __DIR__ )/generatedElements.jld2", "w")
close(io)
save("$(@ __DIR__ )/generatedElements.jld2", "Sim", Sim)
end
end

```

However, calling `readFile.jl` to read the generated `.jld2` gives this warning and typeof `Sim` is `Simulation`

```julia
┌ Warning: type readApp.Simulation does not exist in workspace; reconstructing
└ @ JLD2 C:\Users\amroa\.julia\packages\JLD2\k9Gt0\src\data\reconstructing_datatypes.jl:461
julia> typeof(Sim)
JLD2.ReconstructedTypes.var"##readApp.Simulation#292"

```

How can I get ride of the warning and fix the typeof(Sim) to be of `Simulation`?

---

<div class="post-metadata">

**Author:** ![JonasIsensee](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jonasisensee/32/4704_2.png) [@JonasIsensee](https://discourse.julialang.org/u/JonasIsensee)\
**Post date:** [March 22, 2022, 8:11am UTC](https://discourse.julialang.org/t/warning-type-does-not-exist-in-workspace-reconstructing/78232/2 "2022-03-22T08:11:22Z")

</div>

Answer is at:  
[https://github.com/JuliaIO/JLD2.jl/issues/390](https://github.com/JuliaIO/JLD2.jl/issues/390)
