`mul_float: types of a and b must match` error in ModelingToolkit

I am getting the mul_float: types of a and b must match error in my code that uses ModelingToolkit in which I am solving an ODAEProblem costructed from ODESystem in a loop. In each iteration I am modifying the ODESystem while defining the ODAEProblem and solving it. It runs for 5-6 iterations and absuptly breaks down and gives this error :

mul_float: types of a and b must match

1. <mark> ***** </mark>@ *float.jl:332* [inlined]
2. <mark> **macro expansion** </mark>@ *code.jl:351* [inlined]
3. <mark> **macro expansion** </mark>@ *RuntimeGeneratedFunctions.jl:129* [inlined]
4. <mark> **macro expansion** </mark>@ *none:0* [inlined]
5. <mark> **generated_callfunc** </mark>@ *none:0* [inlined]
6. <mark>(::RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(Symbol("##out#7673"), Symbol("##arg#14895969777671410020"), Symbol("##arg#12397454687446245267"), :t), ModelingToolkit.StructuralTransformations.var"#_RGF_ModTag", ModelingToolkit.StructuralTransformations.var"#_RGF_ModTag", (0xc101f4de, 0x01f1b297, 0xa7adcaa8, 0x3608c6d6, 0x144371da)})(::Vector{Float64}, ::Vector{Float64}, ::Vector{Float64}, ::Float64)</mark>@ *RuntimeGeneratedFunctions.jl:117*
7. <mark> **ODEFunction** </mark>@ *scimlfunctions.jl:334* [inlined]
8. <mark> **initialize!** (::OrdinaryDiffEq.ODEIntegrator{OrdinaryDiffEq.Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, true, Vector{Float64}, Nothing, Float64, Vector{Float64}, Float64, Float64, Float64, Float64, Vector{Vector{Float64}}, SciMLBase.ODESolution{Float64, 2, Vector{Vector{Float64}}, Nothing, Nothing, Vector{Float64}, Vector{Vector{Vector{Float64}}}, SciMLBase.ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, Vector{Float64}, SciMLBase.ODEFunction{true, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(Symbol("##out#7673"), Symbol("##arg#14895969777671410020"), Symbol("##arg#12397454687446245267"), :t), ModelingToolkit.StructuralTransformations.var"#_RGF_ModTag", ModelingToolkit.StructuralTransformations.var"#_RGF_ModTag", (0xc101f4de, 0x01f1b297, 0xa7adcaa8, 0x3608c6d6, 0x144371da)}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, SparseArrays.SparseMatrixCSC{Bool, Int64}, Nothing, Nothing, Nothing, Vector{Symbol}, Nothing, ModelingToolkit.StructuralTransformations.var"#generated_observed#186"{Bool, ModelingToolkit.BipartiteGraphs.Matching{ModelingToolkit.BipartiteGraphs.Unassigned, Vector{Union{ModelingToolkit.BipartiteGraphs.Unassigned, Int64}}}, ModelingToolkit.SystemStructures.TearingState{ModelingToolkit.ODESystem}, Dict{Any, Any}, Vector{SymbolicUtils.Code.Assignment}, Tuple{Vector{Vector{Int64}}, Vector{BitSet}}, SymbolicUtils.Code.NameState, Dict{Any, Int64}}, Nothing}, Base.Iterators.Pairs{Symbol, SciMLBase.VectorContinuousCallback{ModelingToolkit.var"#248#258"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), Symbolics.var"#_RGF_ModTag", Symbolics.var"#_RGF_ModTag", (0xe789e85d, 0xe1bdd0de, 0xcf5e9c2d, 0xad52a705, 0xc6e37bad)}}, ModelingToolkit.var"#250#260"{Vector{Function}, Vector{Int64}}, ModelingToolkit.var"#250#260"{Vector{Function}, Vector{Int64}}, typeof(SciMLBase.INITIALIZE_DEFAULT), typeof(SciMLBase.FINALIZE_DEFAULT), Float64, Int64, Rational{Int64}, Nothing, Int64}, Tuple{Symbol}, NamedTuple{(:callback,), Tuple{SciMLBase.VectorContinuousCallback{ModelingToolkit.var"#248#258"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), Symbolics.var"#_RGF_ModTag", Symbolics.var"#_RGF_ModTag", (0xe789e85d, 0xe1bdd0de, 0xcf5e9c2d, 0xad52a705, 0xc6e37bad)}}, ModelingToolkit.var"#250#260"{Vector{Function}, Vector{Int64}}, ModelingToolkit.var"#250#260"{Vector{Function}, Vector{Int64}}, typeof(SciMLBase.INITIALIZE_DEFAULT), typeof(SciMLBase.FINALIZE_DEFAULT), Float64, Int64, Rational{Int64}, Nothing, Int64}}}}, SciMLBase.StandardODEProblem}, OrdinaryDiffEq.Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, OrdinaryDiffEq.InterpolationData{SciMLBase.ODEFunction{true, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(Symbol("##out#7673"), Symbol("##arg#14895969777671410020"), Symbol("##arg#12397454687446245267"), :t), ModelingToolkit.StructuralTransformations.var"#_RGF_ModTag", ModelingToolkit.StructuralTransformations.var"#_RGF_ModTag", (0xc101f4de, 0x01f1b297, 0xa7adcaa8, 0x3608c6d6, 0x144371da)}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, SparseArrays.SparseMatrixCSC{Bool, Int64}, Nothing, Nothing, Nothing, Vector{Symbol}, Nothing, ModelingToolkit.StructuralTransformations.var"#generated_observed#186"{Bool, ModelingToolkit.BipartiteGraphs.Matching{ModelingToolkit.BipartiteGraphs.Unassigned, Vector{Union{ModelingToolkit.BipartiteGraphs.Unassigned, Int64}}}, ModelingToolkit.SystemStructures.TearingState{ModelingToolkit.ODESystem}, Dict{Any, Any}, Vector{SymbolicUtils.Code.Assignment}, Tuple{Vector{Vector{Int64}}, Vector{BitSet}}, SymbolicUtils.Code.NameState, Dict{Any, Int64}}, Nothing}, Vector{Vector{Float64}}, Vector{Float64}, Vector{Vector{Vector{Float64}}}, OrdinaryDiffEq.Tsit5Cache{Vector{Float64}, Vector{Float64}, Vector{Float64}, OrdinaryDiffEq.Tsit5ConstantCache{Float64, Float64}, typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}}, DiffEqBase.DEStats}, SciMLBase.ODEFunction{true, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(Symbol("##out#7673"), Symbol("##arg#14895969777671410020"), Symbol("##arg#12397454687446245267"), :t), ModelingToolkit.StructuralTransformations.var"#_RGF_ModTag", ModelingToolkit.StructuralTransformations.var"#_RGF_ModTag", (0xc101f4de, 0x01f1b297, 0xa7adcaa8, 0x3608c6d6, 0x144371da)}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, SparseArrays.SparseMatrixCSC{Bool, Int64}, Nothing, Nothing, Nothing, Vector{Symbol}, Nothing, ModelingToolkit.StructuralTransformations.var"#generated_observed#186"{Bool, ModelingToolkit.BipartiteGraphs.Matching{ModelingToolkit.BipartiteGraphs.Unassigned, Vector{Union{ModelingToolkit.BipartiteGraphs.Unassigned, Int64}}}, ModelingToolkit.SystemStructures.TearingState{ModelingToolkit.ODESystem}, Dict{Any, Any}, Vector{SymbolicUtils.Code.Assignment}, Tuple{Vector{Vector{Int64}}, Vector{BitSet}}, SymbolicUtils.Code.NameState, Dict{Any, Int64}}, Nothing}, OrdinaryDiffEq.Tsit5Cache{Vector{Float64}, Vector{Float64}, Vector{Float64}, OrdinaryDiffEq.Tsit5ConstantCache{Float64, Float64}, typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, OrdinaryDiffEq.DEOptions{Float64, Float64, Float64, Float64, OrdinaryDiffEq.PIController{Rational{Int64}}, typeof(DiffEqBase.ODE_DEFAULT_NORM), typeof(LinearAlgebra.opnorm), Nothing, SciMLBase.CallbackSet{Tuple{SciMLBase.VectorContinuousCallback{ModelingToolkit.var"#248#258"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), Symbolics.var"#_RGF_ModTag", Symbolics.var"#_RGF_ModTag", (0xe789e85d, 0xe1bdd0de, 0xcf5e9c2d, 0xad52a705, 0xc6e37bad)}}, ModelingToolkit.var"#250#260"{Vector{Function}, Vector{Int64}}, ModelingToolkit.var"#250#260"{Vector{Function}, Vector{Int64}}, typeof(SciMLBase.INITIALIZE_DEFAULT), typeof(SciMLBase.FINALIZE_DEFAULT), Float64, Int64, Rational{Int64}, Nothing, Int64}}, Tuple{}}, typeof(DiffEqBase.ODE_DEFAULT_ISOUTOFDOMAIN), typeof(DiffEqBase.ODE_DEFAULT_PROG_MESSAGE), typeof(DiffEqBase.ODE_DEFAULT_UNSTABLE_CHECK), DataStructures.BinaryHeap{Float64, DataStructures.FasterForward}, DataStructures.BinaryHeap{Float64, DataStructures.FasterForward}, Nothing, Nothing, Int64, Tuple{}, Float64, Tuple{}}, Vector{Float64}, Float64, DiffEqBase.CallbackCache{Vector{Float64}, Vector{Float64}}, OrdinaryDiffEq.DefaultInit}, ::OrdinaryDiffEq.Tsit5Cache{Vector{Float64}, Vector{Float64}, Vector{Float64}, OrdinaryDiffEq.Tsit5ConstantCache{Float64, Float64}, typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False})</mark>@ *low_order_rk_perform_step.jl:627*
9. <mark> **var"#__init#496"** (::Float64, ::Tuple{}, ::Tuple{}, ::Nothing, ::Bool, ::Bool, ::Bool, ::Nothing, ::SciMLBase.VectorContinuousCallback{ModelingToolkit.var"#248#258"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), Symbolics.var"#_RGF_ModTag", Symbolics.var"#_RGF_ModTag", (0xe789e85d, 0xe1bdd0de, 0xcf5e9c2d, 0xad52a705, 0xc6e37bad)}}, ModelingToolkit.var"#250#260"{Vector{Function}, Vector{Int64}}, ModelingToolkit.var"#250#260"{Vector{Function}, Vector{Int64}}, typeof(SciMLBase.INITIALIZE_DEFAULT), typeof(SciMLBase.FINALIZE_DEFAULT), Float64, Int64, Rational{Int64}, Nothing, Int64}, ::Bool, ::Bool, ::Float64, ::Nothing, ::Float64, ::Bool, ::Bool, ::Rational{Int64}, ::Nothing, ::Nothing, ::Rational{Int64}, ::Int64, ::Int64, ::Int64, ::Nothing, ::Nothing, ::Rational{Int64}, ::Nothing, ::Bool, ::Int64, ::Int64, ::typeof(DiffEqBase.ODE_DEFAULT_NORM), ::typeof(LinearAlgebra.opnorm), ::typeof(DiffEqBase.ODE_DEFAULT_ISOUTOFDOMAIN), ::typeof(DiffEqBase.ODE_DEFAULT_UNSTABLE_CHECK), ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::Bool, ::Int64, ::String, ::typeof(DiffEqBase.ODE_DEFAULT_PROG_MESSAGE), ::Nothing, ::Bool, ::Bool, ::Bool, ::Bool, ::OrdinaryDiffEq.DefaultInit, ::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}}, ::typeof(SciMLBase.__init), ::SciMLBase.ODEProblem{Vector{Float64}, Tuple{Float64, Float64}, true, Vector{Float64}, SciMLBase.ODEFunction{true, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(Symbol("##out#7673"), Symbol("##arg#14895969777671410020"), Symbol("##arg#12397454687446245267"), :t), ModelingToolkit.StructuralTransformations.var"#_RGF_ModTag", ModelingToolkit.StructuralTransformations.var"#_RGF_ModTag", (0xc101f4de, 0x01f1b297, 0xa7adcaa8, 0x3608c6d6, 0x144371da)}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, SparseArrays.SparseMatrixCSC{Bool, Int64}, Nothing, Nothing, Nothing, Vector{Symbol}, Nothing, ModelingToolkit.StructuralTransformations.var"#generated_observed#186"{Bool, ModelingToolkit.BipartiteGraphs.Matching{ModelingToolkit.BipartiteGraphs.Unassigned, Vector{Union{ModelingToolkit.BipartiteGraphs.Unassigned, Int64}}}, ModelingToolkit.SystemStructures.TearingState{ModelingToolkit.ODESystem}, Dict{Any, Any}, Vector{SymbolicUtils.Code.Assignment}, Tuple{Vector{Vector{Int64}}, Vector{BitSet}}, SymbolicUtils.Code.NameState, Dict{Any, Int64}}, Nothing}, Base.Iterators.Pairs{Symbol, SciMLBase.VectorContinuousCallback{ModelingToolkit.var"#248#258"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), Symbolics.var"#_RGF_ModTag", Symbolics.var"#_RGF_ModTag", (0xe789e85d, 0xe1bdd0de, 0xcf5e9c2d, 0xad52a705, 0xc6e37bad)}}, ModelingToolkit.var"#250#260"{Vector{Function}, Vector{Int64}}, ModelingToolkit.var"#250#260"{Vector{Function}, Vector{Int64}}, typeof(SciMLBase.INITIALIZE_DEFAULT), typeof(SciMLBase.FINALIZE_DEFAULT), Float64, Int64, Rational{Int64}, Nothing, Int64}, Tuple{Symbol}, NamedTuple{(:callback,), Tuple{SciMLBase.VectorContinuousCallback{ModelingToolkit.var"#248#258"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), Symbolics.var"#_RGF_ModTag", Symbolics.var"#_RGF_ModTag", (0xe789e85d, 0xe1bdd0de, 0xcf5e9c2d, 0xad52a705, 0xc6e37bad)}}, ModelingToolkit.var"#250#260"{Vector{Function}, Vector{Int64}}, ModelingToolkit.var"#250#260"{Vector{Function}, Vector{Int64}}, typeof(SciMLBase.INITIALIZE_DEFAULT), typeof(SciMLBase.FINALIZE_DEFAULT), Float64, Int64, Rational{Int64}, Nothing, Int64}}}}, SciMLBase.StandardODEProblem}, ::OrdinaryDiffEq.Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False}, ::Tuple{}, ::Tuple{}, ::Tuple{}, ::Type{Val{true}})</mark>@ *solve.jl:456*
10. <mark> **#__solve#495** </mark>@ *solve.jl:4* [inlined]
11. <mark> **#solve_call#37** </mark>@ *solve.jl:61* [inlined]
12. <mark> **var"#solve_up#39"** (::Base.Iterators.Pairs{Symbol, Float64, Tuple{Symbol}, NamedTuple{(:saveat,), Tuple{Float64}}}, ::typeof(DiffEqBase.solve_up), ::SciMLBase.ODEProblem{Vector{Float64}, Tuple{Int64, Int64}, true, Vector{Float64}, SciMLBase.ODEFunction{true, RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(Symbol("##out#7673"), Symbol("##arg#14895969777671410020"), Symbol("##arg#12397454687446245267"), :t), ModelingToolkit.StructuralTransformations.var"#_RGF_ModTag", ModelingToolkit.StructuralTransformations.var"#_RGF_ModTag", (0xc101f4de, 0x01f1b297, 0xa7adcaa8, 0x3608c6d6, 0x144371da)}, LinearAlgebra.UniformScaling{Bool}, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, SparseArrays.SparseMatrixCSC{Bool, Int64}, Nothing, Nothing, Nothing, Vector{Symbol}, Nothing, ModelingToolkit.StructuralTransformations.var"#generated_observed#186"{Bool, ModelingToolkit.BipartiteGraphs.Matching{ModelingToolkit.BipartiteGraphs.Unassigned, Vector{Union{ModelingToolkit.BipartiteGraphs.Unassigned, Int64}}}, ModelingToolkit.SystemStructures.TearingState{ModelingToolkit.ODESystem}, Dict{Any, Any}, Vector{SymbolicUtils.Code.Assignment}, Tuple{Vector{Vector{Int64}}, Vector{BitSet}}, SymbolicUtils.Code.NameState, Dict{Any, Int64}}, Nothing}, Base.Iterators.Pairs{Symbol, SciMLBase.VectorContinuousCallback{ModelingToolkit.var"#248#258"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), Symbolics.var"#_RGF_ModTag", Symbolics.var"#_RGF_ModTag", (0xe789e85d, 0xe1bdd0de, 0xcf5e9c2d, 0xad52a705, 0xc6e37bad)}}, ModelingToolkit.var"#250#260"{Vector{Function}, Vector{Int64}}, ModelingToolkit.var"#250#260"{Vector{Function}, Vector{Int64}}, typeof(SciMLBase.INITIALIZE_DEFAULT), typeof(SciMLBase.FINALIZE_DEFAULT), Float64, Int64, Rational{Int64}, Nothing, Int64}, Tuple{Symbol}, NamedTuple{(:callback,), Tuple{SciMLBase.VectorContinuousCallback{ModelingToolkit.var"#248#258"{RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:ˍ₋out, :ˍ₋arg1, :ˍ₋arg2, :t), Symbolics.var"#_RGF_ModTag", Symbolics.var"#_RGF_ModTag", (0xe789e85d, 0xe1bdd0de, 0xcf5e9c2d, 0xad52a705, 0xc6e37bad)}}, ModelingToolkit.var"#250#260"{Vector{Function}, Vector{Int64}}, ModelingToolkit.var"#250#260"{Vector{Function}, Vector{Int64}}, typeof(SciMLBase.INITIALIZE_DEFAULT), typeof(SciMLBase.FINALIZE_DEFAULT), Float64, Int64, Rational{Int64}, Nothing, Int64}}}}, SciMLBase.StandardODEProblem}, ::Nothing, ::Vector{Float64}, ::Vector{Float64}, ::OrdinaryDiffEq.Tsit5{typeof(OrdinaryDiffEq.trivial_limiter!), typeof(OrdinaryDiffEq.trivial_limiter!), Static.False})</mark>@ *solve.jl:87*
13. <mark> **#solve#38** </mark>@ *solve.jl:73* [inlined]
14. <mark> **top-level scope** </mark>@ *[Local: 39](http://localhost:1234/edit?id=ef931f06-9d73-11ec-0625-d34dd6714ba6#)*

I have seen a simillar issue in this post:

I am attaching the relevant parts of my code below :

This loop does the following :
    # 1) generates an array of ODESystem nrn_network
    # 2) connects the array of ODESystems using adjacency matrix syn 
    # 3) construct an ODAEProblem and solve it
    # 4) use the solution to update the adjacency matrix syn which will be used to connect the ODESystem in next loop iteration 
    # In every iteration some we update some parameters of ODESystem array nrn_network and update the adjacency matrix syn
    # The error will not show if we do not update the adjacency matrix syn
    for loop = 1:20
     
      # nrn_network is an array of ODESystems using function IF_neurons
        nrn_network=[]
            for ii = 1:Nrns
        
                 nn = IF_neuron(name=Symbol("nrn$ii"),E_syn=E_syn[ii],G_syn=G_syn[ii],I_in=I_in[ii],freq=freq[ii], phase=phase[ii], τ=τ[ii])
        
                 push!(nrn_network,nn)
            end
         
            #this function takes the array of ODESystems nrn_network and connects them using adjacensy matrix syn 
            #creating a larger ODESystem syn_net
        @named syn_net = synaptic_network(sys=nrn_network,adj_matrix=syn)
    
        prob = ODAEProblem(syn_net, [], (0, simtime))
        
        solt = solve(prob,Tsit5(),saveat=0.01)
        sol = DataFrame(solt)	
    
    
        for ii = 1:length(targ)
                    ###

                    # this hidden portion of the code generates an array act_syn using the solution of ODAEProblem

                    ###

               #THIS LOOP MODIFIES THE ADJACENCY MATRIX syn
            for jj = 1:length(act_syn)
                    syn[targ[ii],act_syn[jj]] = syn[targ[ii],act_syn[jj]] + 0.02*length(tt)
            end
    
        end
            
    end


    # This function takes an array of ODESystem and connects them, generates a larger ODESystem using 'compose' and does 'structural_simplify'

    function synaptic_network(;name, sys=sys, adj_matrix=adj_matrix)
        syn_eqs= [ 0~sys[1].V - sys[1].V]
                
        for ii = 1:length(sys)
               
            presyn = findall(x-> x>0, adj_matrix[ii,:])
            wts = adj_matrix[ii,presyn]		
            presyn_nrn = sys[presyn]
            postsyn_nrn = sys[ii]
                
            if length(presyn)>0
                        
                ind = [i for i = 1:length(presyn)];
                eq = [0 ~ sum(p-> (presyn_nrn[p].E_syn-postsyn_nrn.V)*presyn_nrn[p].G*wts[p],ind)-postsyn_nrn.Isyn]
                push!(syn_eqs,eq[1])
                
            else
                eq = [0~postsyn_nrn.Isyn];
                push!(syn_eqs,eq[1]);
             
            end
        end
        popfirst!(syn_eqs)
        
        @named synaptic_eqs = ODESystem(syn_eqs,t)
        
        sys_ode = [sys[ii] for ii = 1:length(sys)]
    
        @named synaptic_network = compose(synaptic_eqs, sys_ode)
        return structural_simplify(synaptic_network)   
    end

Important thing to note is that the loop does not breakdown if I do not update the adjacency matrix ‘syn’ and only update the parameters of nrn_network. Also, the error only shows up after few successful iterations of the loop. Please help me how to resolve this error. I am using the latest version of MTK.

@ChrisRackauckas

Following up privately.

I have also just stumbled on this error using compose and structural simplify to build a network of Izhikevich neurons connected by multiple synapses. In general the first iteration/version of the network runs fine, but subsequent changes to the network connectivity and solves throw the error as described by @anandpathak31.

Was the cause and/or a solution found?

No. I am still working on finding the cause with @ChrisRackauckas. First step
is to create a minimal version of the code which will produce the same error.
I am working to create the minimal example. It is still not clear if the error is due to structural_simplify and compose or simply just creating and recreating
any ODESystem within a loop will give that error.

I see. I, unfortunately don’t have anything helpful to add to that end, but if I manage to write/change some code that causes the error in a reproducible way I’ll be sure to follow up, here. Thanks for the update, much appreciated

I am getting the same error in a similar situation. Have you found a solution @anandpathak31 @ChrisRackauckas ?

It needs a fix in Julia Base. Follow this issue for details:

https://github.com/SciML/RuntimeGeneratedFunctions.jl/issues/13