# Hard to find error (might relate to Zygote)

**URL:** <https://discourse.julialang.org/t/hard-to-find-error-might-relate-to-zygote/98421>\
**Category:** Performance\
**Tags:** question\
**Created:** [May 6, 2023, 5:32pm UTC](https://discourse.julialang.org/t/hard-to-find-error-might-relate-to-zygote/98421 "2023-05-06T17:32:48Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![erlebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/erlebach/32/12973_2.png) [@erlebach](https://discourse.julialang.org/u/erlebach)\
**Post date:** [May 6, 2023, 5:32pm UTC](https://discourse.julialang.org/t/hard-to-find-error-might-relate-to-zygote/98421/1 "2023-05-06T17:32:48Z")

</div>

@ChrisRackauckas

Note the stack trace below. But first some comments:  
There is an error in the `init(::Nothing, ::Tsit5...)` function. I should be able to locate this `Init` function in the Julia library. I have not found a line number pointing to it. Why is that? What am I missing? The closest candidates do not help. Way down in the stack trace, I find the first reference to my own program. The error starts somewhere inside:

```julia
	sim = solve(ensemble_prob, Tsit5(), ensemble, trajectories=trajectories, 
		    sensealg = InterpolatingAdjoint(autojacvec=ReverseDiffVJP(true)), saveat=0.2);  

```

I printed all the arguments and there was nothing strange. With a debugger, I could trace into the the `solve` function, but if the automatic tracer could not identify the `init` command at hand, why would I be able to? Advice is appreciated. Thanks.

Full stack trace:

```julia
ERROR: MethodError: no method matching init(::Nothing, ::Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}; sensealg::InterpolatingAdjoint{0, true, Val{:central}, ReverseDiffVJP{true}}, saveat::Float64)

Closest candidates are:
  init(::OptimizationProblem, ::Any, ::Any...; kwargs...)
   @ SciMLBase ~/.julia/packages/SciMLBase/VdcHg/src/solve.jl:146
  init(::PDEProblem, ::SciMLBase.AbstractDEAlgorithm, ::Any...; kwargs...)
   @ DiffEqBase ~/.julia/packages/DiffEqBase/ZXMKG/src/solve.jl:1050
  init(::SciMLBase.AbstractJumpProblem, ::Any...; kwargs...)
   @ DiffEqBase ~/.julia/packages/DiffEqBase/ZXMKG/src/solve.jl:443
  ...
Stacktrace:
  [1] macro expansion
    @ ~/.julia/packages/Zygote/SuKWp/src/compiler/interface2.jl:0 [inlined]
  [2] _pullback(::Zygote.Context{false}, ::typeof(Core.kwcall), ::NamedTuple{(:sensealg, :saveat), Tuple{InterpolatingAdjoint{0, true, Val{:central}, ReverseDiffVJP{true}}, Float64}}, ::typeof(init), ::Nothing, ::Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False})
    @ Zygote ~/.julia/packages/Zygote/SuKWp/src/compiler/interface2.jl:9
  [3] _apply(::Function, ::Vararg{Any})
    @ Core ./boot.jl:838
  [4] adjoint
    @ ~/.julia/packages/Zygote/SuKWp/src/lib/lib.jl:203 [inlined]
  [5] _pullback
    @ ~/.julia/packages/ZygoteRules/OgCVT/src/adjoint.jl:66 [inlined]
  [6] _pullback
    @ ~/.julia/packages/CommonSolve/u9cNO/src/CommonSolve.jl:23 [inlined]
  [7] _pullback(::Zygote.Context{false}, ::CommonSolve.var"##solve#1", ::Base.Pairs{Symbol, Any, Tuple{Symbol, Symbol}, NamedTuple{(:sensealg, :saveat), Tuple{InterpolatingAdjoint{0, true, Val{:central}, ReverseDiffVJP{true}}, Float64}}}, ::typeof(solve), ::Nothing, ::Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False})
    @ Zygote ~/.julia/packages/Zygote/SuKWp/src/compiler/interface2.jl:0
  [8] _apply(::Function, ::Vararg{Any})
    @ Core ./boot.jl:838
  [9] adjoint
    @ ~/.julia/packages/Zygote/SuKWp/src/lib/lib.jl:203 [inlined]
 [10] _pullback
    @ ~/.julia/packages/ZygoteRules/OgCVT/src/adjoint.jl:66 [inlined]
 [11] _pullback
    @ ~/.julia/packages/CommonSolve/u9cNO/src/CommonSolve.jl:23 [inlined]
 [12] _pullback
    @ ~/.julia/packages/SciMLBase/VdcHg/src/ensemble/basic_ensemble_solve.jl:92 [inlined]
 [13] _pullback(::Zygote.Context{false}, ::SciMLBase.var"##batch_func#535", ::Base.Pairs{Symbol, Any, Tuple{Symbol, Symbol}, NamedTuple{(:sensealg, :saveat), Tuple{InterpolatingAdjoint{0, true, Val{:central}, ReverseDiffVJP{true}}, Float64}}}, ::typeof(SciMLBase.batch_func), ::Int64, ::EnsembleProblem{ODEProblem{SizedMatrix{3, 3, Float32, 2, Matrix{Float32}}, Tuple{Float32, Float32}, true, Vector{Float64}, ODEFunction{true, SciMLBase.AutoSpecialize, var"#dudt_protocol!#7"{Vector{Vector{Function}}, Chain{Tuple{Dense{typeof(tanh), Matrix{Float32}, Vector{Float32}}, Dense{typeof(identity), Matrix{Float32}, Vector{Float32}}}}, Vector{Float64}}, UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, var"#prob_func#8"{Vector{Vector{Function}}, Vector{Tuple{Float32, Float32}}, Chain{Tuple{Dense{typeof(tanh), Matrix{Float32}, Vector{Float32}}, Dense{typeof(identity), Matrix{Float32}, Vector{Float32}}}}, Vector{Float64}}, typeof(SciMLBase.DEFAULT_OUTPUT_FUNC), typeof(SciMLBase.DEFAULT_REDUCTION), Nothing}, ::Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False})
    @ Zygote ~/.julia/packages/Zygote/SuKWp/src/compiler/interface2.jl:0
 [14] _pullback
    @ ~/.julia/packages/SciMLBase/VdcHg/src/ensemble/basic_ensemble_solve.jl:87 [inlined]
 [15] _pullback
    @ ~/.julia/packages/SciMLBase/VdcHg/src/ensemble/basic_ensemble_solve.jl:146 [inlined]
 [16] (::DiffEqBaseZygoteExt.var"#8#11"{Zygote.Context{false}, SciMLBase.var"#540#541"{Base.Pairs{Symbol, Any, Tuple{Symbol, Symbol}, NamedTuple{(:sensealg, :saveat), Tuple{InterpolatingAdjoint{0, true, Val{:central}, ReverseDiffVJP{true}}, Float64}}}, EnsembleProblem{ODEProblem{SizedMatrix{3, 3, Float32, 2, Matrix{Float32}}, Tuple{Float32, Float32}, true, Vector{Float64}, ODEFunction{true, SciMLBase.AutoSpecialize, var"#dudt_protocol!#7"{Vector{Vector{Function}}, Chain{Tuple{Dense{typeof(tanh), Matrix{Float32}, Vector{Float32}}, Dense{typeof(identity), Matrix{Float32}, Vector{Float32}}}}, Vector{Float64}}, UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, var"#prob_func#8"{Vector{Vector{Function}}, Vector{Tuple{Float32, Float32}}, Chain{Tuple{Dense{typeof(tanh), Matrix{Float32}, Vector{Float32}}, Dense{typeof(identity), Matrix{Float32}, Vector{Float32}}}}, Vector{Float64}}, typeof(SciMLBase.DEFAULT_OUTPUT_FUNC), typeof(SciMLBase.DEFAULT_REDUCTION), Nothing}, Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}}})(args::Int64)
    @ DiffEqBaseZygoteExt ~/.julia/packages/DiffEqBase/ZXMKG/ext/DiffEqBaseZygoteExt.jl:24
 [17] responsible_map(f::Function, II::UnitRange{Int64})
    @ SciMLBase ~/.julia/packages/SciMLBase/VdcHg/src/ensemble/basic_ensemble_solve.jl:139
 [18] ∇responsible_map(cx::Zygote.Context{false}, f::Function, args::UnitRange{Int64})
    @ DiffEqBaseZygoteExt ~/.julia/packages/DiffEqBase/ZXMKG/ext/DiffEqBaseZygoteExt.jl:24
 [19] adjoint
    @ ~/.julia/packages/DiffEqBase/ZXMKG/ext/DiffEqBaseZygoteExt.jl:51 [inlined]
 [20] _pullback
    @ ~/.julia/packages/ZygoteRules/OgCVT/src/adjoint.jl:66 [inlined]
 [21] _pullback
    @ ~/.julia/packages/SciMLBase/VdcHg/src/ensemble/basic_ensemble_solve.jl:145 [inlined]
 [22] _pullback(::Zygote.Context{false}, ::SciMLBase.var"##solve_batch#539", ::Base.Pairs{Symbol, Any, Tuple{Symbol, Symbol}, NamedTuple{(:sensealg, :saveat), Tuple{InterpolatingAdjoint{0, true, Val{:central}, ReverseDiffVJP{true}}, Float64}}}, ::typeof(SciMLBase.solve_batch), ::EnsembleProblem{ODEProblem{SizedMatrix{3, 3, Float32, 2, Matrix{Float32}}, Tuple{Float32, Float32}, true, Vector{Float64}, ODEFunction{true, SciMLBase.AutoSpecialize, var"#dudt_protocol!#7"{Vector{Vector{Function}}, Chain{Tuple{Dense{typeof(tanh), Matrix{Float32}, Vector{Float32}}, Dense{typeof(identity), Matrix{Float32}, Vector{Float32}}}}, Vector{Float64}}, UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, var"#prob_func#8"{Vector{Vector{Function}}, Vector{Tuple{Float32, Float32}}, Chain{Tuple{Dense{typeof(tanh), Matrix{Float32}, Vector{Float32}}, Dense{typeof(identity), Matrix{Float32}, Vector{Float32}}}}, Vector{Float64}}, typeof(SciMLBase.DEFAULT_OUTPUT_FUNC), typeof(SciMLBase.DEFAULT_REDUCTION), Nothing}, ::Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, ::EnsembleSerial, ::UnitRange{Int64}, ::Int64)
    @ Zygote ~/.julia/packages/Zygote/SuKWp/src/compiler/interface2.jl:0
 [23] _pullback
    @ ~/.julia/packages/SciMLBase/VdcHg/src/ensemble/basic_ensemble_solve.jl:144 [inlined]
 [24] _pullback(::Zygote.Context{false}, ::typeof(Core.kwcall), ::NamedTuple{(:sensealg, :saveat), Tuple{InterpolatingAdjoint{0, true, Val{:central}, ReverseDiffVJP{true}}, Float64}}, ::typeof(SciMLBase.solve_batch), ::EnsembleProblem{ODEProblem{SizedMatrix{3, 3, Float32, 2, Matrix{Float32}}, Tuple{Float32, Float32}, true, Vector{Float64}, ODEFunction{true, SciMLBase.AutoSpecialize, var"#dudt_protocol!#7"{Vector{Vector{Function}}, Chain{Tuple{Dense{typeof(tanh), Matrix{Float32}, Vector{Float32}}, Dense{typeof(identity), Matrix{Float32}, Vector{Float32}}}}, Vector{Float64}}, UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, var"#prob_func#8"{Vector{Vector{Function}}, Vector{Tuple{Float32, Float32}}, Chain{Tuple{Dense{typeof(tanh), Matrix{Float32}, Vector{Float32}}, Dense{typeof(identity), Matrix{Float32}, Vector{Float32}}}}, Vector{Float64}}, typeof(SciMLBase.DEFAULT_OUTPUT_FUNC), typeof(SciMLBase.DEFAULT_REDUCTION), Nothing}, ::Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, ::EnsembleSerial, ::UnitRange{Int64}, ::Int64)
    @ Zygote ~/.julia/packages/Zygote/SuKWp/src/compiler/interface2.jl:0
 [25] _pullback
    @ ~/.julia/packages/SciMLBase/VdcHg/src/ensemble/basic_ensemble_solve.jl:155 [inlined]
 [26] _pullback(::Zygote.Context{false}, ::SciMLBase.var"##solve_batch#542", ::Base.Pairs{Symbol, Any, Tuple{Symbol, Symbol}, NamedTuple{(:sensealg, :saveat), Tuple{InterpolatingAdjoint{0, true, Val{:central}, ReverseDiffVJP{true}}, Float64}}}, ::typeof(SciMLBase.solve_batch), ::EnsembleProblem{ODEProblem{SizedMatrix{3, 3, Float32, 2, Matrix{Float32}}, Tuple{Float32, Float32}, true, Vector{Float64}, ODEFunction{true, SciMLBase.AutoSpecialize, var"#dudt_protocol!#7"{Vector{Vector{Function}}, Chain{Tuple{Dense{typeof(tanh), Matrix{Float32}, Vector{Float32}}, Dense{typeof(identity), Matrix{Float32}, Vector{Float32}}}}, Vector{Float64}}, UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, var"#prob_func#8"{Vector{Vector{Function}}, Vector{Tuple{Float32, Float32}}, Chain{Tuple{Dense{typeof(tanh), Matrix{Float32}, Vector{Float32}}, Dense{typeof(identity), Matrix{Float32}, Vector{Float32}}}}, Vector{Float64}}, typeof(SciMLBase.DEFAULT_OUTPUT_FUNC), typeof(SciMLBase.DEFAULT_REDUCTION), Nothing}, ::Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, ::EnsembleThreads, ::UnitRange{Int64}, ::Int64)
    @ Zygote ~/.julia/packages/Zygote/SuKWp/src/compiler/interface2.jl:0
 [27] _pullback
    @ ~/.julia/packages/SciMLBase/VdcHg/src/ensemble/basic_ensemble_solve.jl:151 [inlined]
 [28] macro expansion
    @ ./timing.jl:393 [inlined]
 [29] _pullback
    @ ~/.julia/packages/SciMLBase/VdcHg/src/ensemble/basic_ensemble_solve.jl:56 [inlined]
 [30] _pullback(::Zygote.Context{false}, ::SciMLBase.var"##__solve#534", ::Int64, ::Int64, ::Int64, ::Base.Pairs{Symbol, Any, Tuple{Symbol, Symbol}, NamedTuple{(:sensealg, :saveat), Tuple{InterpolatingAdjoint{0, true, Val{:central}, ReverseDiffVJP{true}}, Float64}}}, ::typeof(SciMLBase.__solve), ::EnsembleProblem{ODEProblem{SizedMatrix{3, 3, Float32, 2, Matrix{Float32}}, Tuple{Float32, Float32}, true, Vector{Float64}, ODEFunction{true, SciMLBase.AutoSpecialize, var"#dudt_protocol!#7"{Vector{Vector{Function}}, Chain{Tuple{Dense{typeof(tanh), Matrix{Float32}, Vector{Float32}}, Dense{typeof(identity), Matrix{Float32}, Vector{Float32}}}}, Vector{Float64}}, UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, var"#prob_func#8"{Vector{Vector{Function}}, Vector{Tuple{Float32, Float32}}, Chain{Tuple{Dense{typeof(tanh), Matrix{Float32}, Vector{Float32}}, Dense{typeof(identity), Matrix{Float32}, Vector{Float32}}}}, Vector{Float64}}, typeof(SciMLBase.DEFAULT_OUTPUT_FUNC), typeof(SciMLBase.DEFAULT_REDUCTION), Nothing}, ::Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, ::EnsembleThreads)
    @ Zygote ~/.julia/packages/Zygote/SuKWp/src/compiler/interface2.jl:0
 [31] _pullback
    @ ~/.julia/packages/SciMLBase/VdcHg/src/ensemble/basic_ensemble_solve.jl:45 [inlined]
 [32] _pullback(::Zygote.Context{false}, ::typeof(Core.kwcall), ::NamedTuple{(:trajectories, :sensealg, :saveat), Tuple{Int64, InterpolatingAdjoint{0, true, Val{:central}, ReverseDiffVJP{true}}, Float64}}, ::typeof(SciMLBase.__solve), ::EnsembleProblem{ODEProblem{SizedMatrix{3, 3, Float32, 2, Matrix{Float32}}, Tuple{Float32, Float32}, true, Vector{Float64}, ODEFunction{true, SciMLBase.AutoSpecialize, var"#dudt_protocol!#7"{Vector{Vector{Function}}, Chain{Tuple{Dense{typeof(tanh), Matrix{Float32}, Vector{Float32}}, Dense{typeof(identity), Matrix{Float32}, Vector{Float32}}}}, Vector{Float64}}, UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, var"#prob_func#8"{Vector{Vector{Function}}, Vector{Tuple{Float32, Float32}}, Chain{Tuple{Dense{typeof(tanh), Matrix{Float32}, Vector{Float32}}, Dense{typeof(identity), Matrix{Float32}, Vector{Float32}}}}, Vector{Float64}}, typeof(SciMLBase.DEFAULT_OUTPUT_FUNC), typeof(SciMLBase.DEFAULT_REDUCTION), Nothing}, ::Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, ::EnsembleThreads)
    @ Zygote ~/.julia/packages/Zygote/SuKWp/src/compiler/interface2.jl:0
 [33] _apply(::Function, ::Vararg{Any})
    @ Core ./boot.jl:838
 [34] adjoint
    @ ~/.julia/packages/Zygote/SuKWp/src/lib/lib.jl:203 [inlined]
 [35] _pullback
    @ ~/.julia/packages/ZygoteRules/OgCVT/src/adjoint.jl:66 [inlined]
 [36] _pullback
    @ ~/.julia/packages/DiffEqBase/ZXMKG/src/solve.jl:995 [inlined]
 [37] _pullback(::Zygote.Context{false}, ::DiffEqBase.var"##solve#32", ::Base.Pairs{Symbol, Any, Tuple{Symbol, Symbol, Symbol}, NamedTuple{(:trajectories, :sensealg, :saveat), Tuple{Int64, InterpolatingAdjoint{0, true, Val{:central}, ReverseDiffVJP{true}}, Float64}}}, ::typeof(solve), ::EnsembleProblem{ODEProblem{SizedMatrix{3, 3, Float32, 2, Matrix{Float32}}, Tuple{Float32, Float32}, true, Vector{Float64}, ODEFunction{true, SciMLBase.AutoSpecialize, var"#dudt_protocol!#7"{Vector{Vector{Function}}, Chain{Tuple{Dense{typeof(tanh), Matrix{Float32}, Vector{Float32}}, Dense{typeof(identity), Matrix{Float32}, Vector{Float32}}}}, Vector{Float64}}, UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, var"#prob_func#8"{Vector{Vector{Function}}, Vector{Tuple{Float32, Float32}}, Chain{Tuple{Dense{typeof(tanh), Matrix{Float32}, Vector{Float32}}, Dense{typeof(identity), Matrix{Float32}, Vector{Float32}}}}, Vector{Float64}}, typeof(SciMLBase.DEFAULT_OUTPUT_FUNC), typeof(SciMLBase.DEFAULT_REDUCTION), Nothing}, ::Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, ::EnsembleThreads)
    @ Zygote ~/.julia/packages/Zygote/SuKWp/src/compiler/interface2.jl:0
 [38] _apply(::Function, ::Vararg{Any})
    @ Core ./boot.jl:838
 [39] adjoint
    @ ~/.julia/packages/Zygote/SuKWp/src/lib/lib.jl:203 [inlined]
 [40] _pullback
    @ ~/.julia/packages/ZygoteRules/OgCVT/src/adjoint.jl:66 [inlined]
 [41] _pullback
    @ ~/.julia/packages/DiffEqBase/ZXMKG/src/solve.jl:991 [inlined]
 [42] _pullback(::Zygote.Context{false}, ::typeof(Core.kwcall), ::NamedTuple{(:trajectories, :sensealg, :saveat), Tuple{Int64, InterpolatingAdjoint{0, true, Val{:central}, ReverseDiffVJP{true}}, Float64}}, ::typeof(solve), ::EnsembleProblem{ODEProblem{SizedMatrix{3, 3, Float32, 2, Matrix{Float32}}, Tuple{Float32, Float32}, true, Vector{Float64}, ODEFunction{true, SciMLBase.AutoSpecialize, var"#dudt_protocol!#7"{Vector{Vector{Function}}, Chain{Tuple{Dense{typeof(tanh), Matrix{Float32}, Vector{Float32}}, Dense{typeof(identity), Matrix{Float32}, Vector{Float32}}}}, Vector{Float64}}, UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), Nothing, Nothing}, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, SciMLBase.StandardODEProblem}, var"#prob_func#8"{Vector{Vector{Function}}, Vector{Tuple{Float32, Float32}}, Chain{Tuple{Dense{typeof(tanh), Matrix{Float32}, Vector{Float32}}, Dense{typeof(identity), Matrix{Float32}, Vector{Float32}}}}, Vector{Float64}}, typeof(SciMLBase.DEFAULT_OUTPUT_FUNC), typeof(SciMLBase.DEFAULT_REDUCTION), Nothing}, ::Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, ::EnsembleThreads)
    @ Zygote ~/.julia/packages/Zygote/SuKWp/src/compiler/interface2.jl:0
 [43] _pullback
    @ ~/src/2022/rude/giesekus/GE_rude.jl/alex_report_code_2023-03-24/julia19/rude_giesekus_optimized.jl:145 [inlined]

 [44] _pullback(::Zygote.Context{false}, ::typeof(ensemble_solve), ::Vector{Float64}, ::EnsembleThreads, ::Vector{Vector{Function}}, ::Vector{Tuple{Float32, Float32}}, ::SizedMatrix{3, 3, Float32, 2, Matrix{Float32}}, ::Int64, ::Chain{Tuple{Dense{typeof(tanh), Matrix{Float32}, Vector{Float32}}, Dense{typeof(identity), Matrix{Float32}, Vector{Float32}}}}, ::Vector{Float64})
    @ Zygote ~/.julia/packages/Zygote/SuKWp/src/compiler/interface2.jl:0
 [45] _pullback
    @ ~/src/2022/rude/giesekus/GE_rude.jl/alex_report_code_2023-03-24/julia19/rude_giesekus_optimized.jl:154 [inlined]
 [46] _pullback(::Zygote.Context{false}, ::typeof(loss_univ), ::Vector{Float64}, ::Vector{Vector{Function}}, ::Vector{Tuple{Float32, Float32}}, ::SizedMatrix{3, 3, Float32, 2, Matrix{Float32}}, ::Vector{Any}, ::Int64, ::Chain{Tuple{Dense{typeof(tanh), Matrix{Float32}, Vector{Float32}}, Dense{typeof(identity), Matrix{Float32}, Vector{Float32}}}}, ::Vector{Float64})
    @ Zygote ~/.julia/packages/Zygote/SuKWp/src/compiler/interface2.jl:0
 [47] _pullback
    @ ~/src/2022/rude/giesekus/GE_rude.jl/alex_report_code_2023-03-24/julia19/rude_giesekus_optimized.jl:274 [inlined]
 [48] _pullback(ctx::Zygote.Context{false}, f::var"#loss_fn#18"{Int64}, args::Vector{Float64})
    @ Zygote ~/.julia/packages/Zygote/SuKWp/src/compiler/interface2.jl:0
 [49] _pullback
    @ ~/src/2022/rude/giesekus/GE_rude.jl/alex_report_code_2023-03-24/julia19/rude_giesekus_optimized.jl:278 [inlined]
 [50] _pullback(::Zygote.Context{false}, ::var"#17#20"{var"#loss_fn#18"{Int64}}, ::Vector{Float64}, ::SciMLBase.NullParameters)
    @ Zygote ~/.julia/packages/Zygote/SuKWp/src/compiler/interface2.jl:0
 [51] _apply
    @ ./boot.jl:838 [inlined]
 [52] adjoint
    @ ~/.julia/packages/Zygote/SuKWp/src/lib/lib.jl:203 [inlined]
 [53] _pullback
    @ ~/.julia/packages/ZygoteRules/OgCVT/src/adjoint.jl:66 [inlined]
 [54] _pullback
    @ ~/.julia/packages/SciMLBase/VdcHg/src/scimlfunctions.jl:3626 [inlined]
 [55] _pullback(::Zygote.Context{false}, ::OptimizationFunction{true, Optimization.AutoZygote, var"#17#20"{var"#loss_fn#18"{Int64}}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED_NO_TIME), Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, ::Vector{Float64}, ::SciMLBase.NullParameters)
    @ Zygote ~/.julia/packages/Zygote/SuKWp/src/compiler/interface2.jl:0
 [56] _apply(::Function, ::Vararg{Any})
    @ Core ./boot.jl:838
 [57] adjoint
    @ ~/.julia/packages/Zygote/SuKWp/src/lib/lib.jl:203 [inlined]
 [58] _pullback
    @ ~/.julia/packages/ZygoteRules/OgCVT/src/adjoint.jl:66 [inlined]
 [59] _pullback
    @ ~/.julia/packages/Optimization/Dzv2g/src/function/zygote.jl:31 [inlined]
 [60] _pullback(ctx::Zygote.Context{false}, f::Optimization.var"#144#153"{OptimizationFunction{true, Optimization.AutoZygote, var"#17#20"{var"#loss_fn#18"{Int64}}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED_NO_TIME), Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, SciMLBase.NullParameters}, args::Vector{Float64})
    @ Zygote ~/.julia/packages/Zygote/SuKWp/src/compiler/interface2.jl:0
 [61] _apply(::Function, ::Vararg{Any})
    @ Core ./boot.jl:838
 [62] adjoint
    @ ~/.julia/packages/Zygote/SuKWp/src/lib/lib.jl:203 [inlined]
 [63] _pullback
    @ ~/.julia/packages/ZygoteRules/OgCVT/src/adjoint.jl:66 [inlined]
 [64] _pullback
    @ ~/.julia/packages/Optimization/Dzv2g/src/function/zygote.jl:35 [inlined]
 [65] _pullback(ctx::Zygote.Context{false}, f::Optimization.var"#146#155"{Tuple{}, Optimization.var"#144#153"{OptimizationFunction{true, Optimization.AutoZygote, var"#17#20"{var"#loss_fn#18"{Int64}}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED_NO_TIME), Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, SciMLBase.NullParameters}}, args::Vector{Float64})
    @ Zygote ~/.julia/packages/Zygote/SuKWp/src/compiler/interface2.jl:0
 [66] pullback(f::Function, cx::Zygote.Context{false}, args::Vector{Float64})
    @ Zygote ~/.julia/packages/Zygote/SuKWp/src/compiler/interface.jl:44
 [67] pullback
    @ ~/.julia/packages/Zygote/SuKWp/src/compiler/interface.jl:42 [inlined]
 [68] gradient(f::Function, args::Vector{Float64})
    @ Zygote ~/.julia/packages/Zygote/SuKWp/src/compiler/interface.jl:96
 [69] (::Optimization.var"#145#154"{Optimization.var"#144#153"{OptimizationFunction{true, Optimization.AutoZygote, var"#17#20"{var"#loss_fn#18"{Int64}}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED_NO_TIME), Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, SciMLBase.NullParameters}})(::Vector{Float64}, ::Vector{Float64})
    @ Optimization ~/.julia/packages/Optimization/Dzv2g/src/function/zygote.jl:33
 [70] macro expansion
    @ ~/.julia/packages/OptimizationOptimisers/FWIuf/src/OptimizationOptimisers.jl:33 [inlined]
 [71] macro expansion
    @ ~/.julia/packages/Optimization/Dzv2g/src/utils.jl:37 [inlined]
 [72] __solve(prob::OptimizationProblem{true, OptimizationFunction{true, Optimization.AutoZygote, var"#17#20"{var"#loss_fn#18"{Int64}}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED_NO_TIME), Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing}, Vector{Float64}, SciMLBase.NullParameters, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}}, opt::Optimisers.AMSGrad{Float32}, data::Base.Iterators.Cycle{Tuple{Optimization.NullData}}; maxiters::Int32, callback::Function, progress::Bool, save_best::Bool, kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ OptimizationOptimisers ~/.julia/packages/OptimizationOptimisers/FWIuf/src/OptimizationOptimisers.jl:32
 [73] __solve (repeats 2 times)
    @ ~/.julia/packages/OptimizationOptimisers/FWIuf/src/OptimizationOptimisers.jl:7 [inlined]
 [74] #solve#553
    @ ~/.julia/packages/SciMLBase/VdcHg/src/solve.jl:86 [inlined]

```

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [May 6, 2023, 5:43pm UTC](https://discourse.julialang.org/t/hard-to-find-error-might-relate-to-zygote/98421/2 "2023-05-06T17:43:51Z")

</div>

This would need an example to debug.

---

<div class="post-metadata">

**Author:** ![erlebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/erlebach/32/12973_2.png) [@erlebach](https://discourse.julialang.org/u/erlebach)\
**Post date:** [May 6, 2023, 5:57pm UTC](https://discourse.julialang.org/t/hard-to-find-error-might-relate-to-zygote/98421/3 "2023-05-06T17:57:36Z")

</div>

I agree, Chris, but creating a MWE is quite difficult and I have spent a few days already. My previous errors founds were all during the search for the MWE. I will put the entire code here, and then you can tell me it is too much to debug. I’ll remove all print statements to shorten it.

I created a somewhat shorter version and now it runs, or appears to run. I’ll do some work and get back and report. Murphy’s law, or its variant, strikes.

---

<div class="post-metadata">

**Author:** ![erlebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/erlebach/32/12973_2.png) [@erlebach](https://discourse.julialang.org/u/erlebach)\
**Post date:** [May 6, 2023, 7:00pm UTC](https://discourse.julialang.org/t/hard-to-find-error-might-relate-to-zygote/98421/4 "2023-05-06T19:00:27Z")

</div>

@ChrisRackauckas,

Strange results. I removed `println` and comments from the code to reduce its size and nothing else. I checked on this carefully with `vimdiff`. Yet, the sanitized code runs fine with no errors, and the non-sanitized code produces the error I reported above. That would imply that one of my print statements has secondary effects. Can you think of another possibility? Debugging this will a while since I must rerun the entire code each time. I really dislike this type of errors. I thought I had left those behind with C, C++, and Fortran. So I have nothing to show you. A better way to find the error might be to add statements slowly to the sanitized code and bring it to a state of the original code. At some point, the error should occur. Thanks.

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [May 6, 2023, 7:25pm UTC](https://discourse.julialang.org/t/hard-to-find-error-might-relate-to-zygote/98421/5 "2023-05-06T19:25:07Z")

</div>

Without code I cannot help.

---

<div class="post-metadata">

**Author:** ![erlebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/erlebach/32/12973_2.png) [@erlebach](https://discourse.julialang.org/u/erlebach)\
**Post date:** [May 6, 2023, 7:34pm UTC](https://discourse.julialang.org/t/hard-to-find-error-might-relate-to-zygote/98421/6 "2023-05-06T19:34:12Z")

</div>

I know, Chris. In the meantime, I have a simple question regarding `EnsembleProblem`, which is a structure with the fields `var` and `body`. The documentation confirms this. However,r when calling this function, as:

```julia
	ensemble_prob = EnsembleProblem(prob, prob_func=prob_func)

```

and then print `ensemble_prob.body`, I get the message that `ensemble_prob` does not have the field `body`. That seems strange to me.

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [May 6, 2023, 7:47pm UTC](https://discourse.julialang.org/t/hard-to-find-error-might-relate-to-zygote/98421/7 "2023-05-06T19:47:38Z")

</div>

There is no `var` and `body`? I have no idea what you’re referring to.

---

<div class="post-metadata">

**Author:** ![erlebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/erlebach/32/12973_2.png) [@erlebach](https://discourse.julialang.org/u/erlebach)\
**Post date:** [May 6, 2023, 8:40pm UTC](https://discourse.julialang.org/t/hard-to-find-error-might-relate-to-zygote/98421/8 "2023-05-06T20:40:53Z")

</div>

![image](https://global.discourse-cdn.com/julialang/original/3X/1/c/1c53c31195f6618161040e2f9ea7909b8e324322.png)

That image was generated by typing `EnsembleProblem.` into the REPL followed by tab. You see `body` and `var` listed, which normally implies that EnsembleProblem is a `struct`. Therefore, I assumed that the return value of the function would be a struct as well with the same fields. The fact that I am mistaken implies that I do not understand as well as I thought.

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [May 6, 2023, 8:42pm UTC](https://discourse.julialang.org/t/hard-to-find-error-might-relate-to-zygote/98421/9 "2023-05-06T20:42:03Z")

</div>

EnsembleProblem is a type.

---

<div class="post-metadata">

**Author:** ![erlebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/erlebach/32/12973_2.png) [@erlebach](https://discourse.julialang.org/u/erlebach)\
**Post date:** [May 6, 2023, 9:27pm UTC](https://discourse.julialang.org/t/hard-to-find-error-might-relate-to-zygote/98421/10 "2023-05-06T21:27:42Z")

</div>

Yes, and a `struct` is a type. So wasn’t `EnsembleProblem` defined as  
`struct EnsembleProblem`?

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [May 6, 2023, 9:30pm UTC](https://discourse.julialang.org/t/hard-to-find-error-might-relate-to-zygote/98421/11 "2023-05-06T21:30:16Z")

</div>

`EnsembleProblem` is a type, it is not an `EnsembleProblem` itself. The fields of an `EnsembleProblem` are different.

---

<div class="post-metadata">

**Author:** ![erlebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/erlebach/32/12973_2.png) [@erlebach](https://discourse.julialang.org/u/erlebach)\
**Post date:** [May 6, 2023, 9:31pm UTC](https://discourse.julialang.org/t/hard-to-find-error-might-relate-to-zygote/98421/12 "2023-05-06T21:31:27Z")

</div>

Thank you, Chris for this clarification.
