Skip to content

ERROR: MethodError: no method matching view(::MTKParameters) after upgrade to 10.21 from 10.17 #3916

@RobbesU

Description

@RobbesU

My MTK model worked fine under 10.17.0 before I went on leave.
After upgrading everything to MTK 10.21.0, I get above MethodError during the ODEProblem() creation step.

As a test I ran the 3637 MWE from this exact same error a while ago: that MWE runs without error so it's another issue.

Expected behavior

ODEProblem() to be created ok as before.

Minimal Reproducible Example 👇
My System, defined in Pluto, is a rather lengthy compilation including parametric functions, so breaking it down to a simple MWE will take significant time. So I'm sort of hoping that the stack trace has the info you need. If not I'll create an MWE (which might not be quite small) and upload to gist. Just ask.
Is there a way I can break down ODEProblem() into smaller steps and see where the error occurs?

Error & Stacktrace ⚠️

MethodError: no method matching view(
::SciMLBase.LinearProblem{
  Vector{Float64}, 
  true, 
  Matrix{Float64}, 
  Vector{Float64}, 
  ModelingToolkit.MTKParameters{
    Vector{Float64}, 
    StaticArraysCore.SizedVector{0, Float64, Vector{Float64}}, 
    Tuple{}, 
    Tuple{Vector{Float64}}, 
    Tuple{}, 
    Tuple{Vector{Float64}}
    }, 
  SciMLBase.SymbolicLinearInterface{
     ModelingToolkit.GeneratedFunctionWrapper{
        (1, 1, true), 
        RuntimeGeneratedFunctions.RuntimeGeneratedFunction{
            (:___mtkparameters___,), 
            ModelingToolkit.var"#_RGF_ModTag", 
            ModelingToolkit.var"#_RGF_ModTag", 
            (0x2c3f7022, 0xc7d55d92, 0x37a04ea8, 0x0cf255a5, 0x12cacc26), 
            Nothing
           }, 
      RuntimeGeneratedFunctions.RuntimeGeneratedFunction{
           (:ˍ₋out, :___mtkparameters___), 
           ModelingToolkit.var"#_RGF_ModTag", 
           ModelingToolkit.var"#_RGF_ModTag", 
           (0xb4f27539, 0x229127e9, 0xbe698f26, 0x219d1033, 0x9d637496), 
           Nothing
           }
     }, 
    ModelingToolkit.GeneratedFunctionWrapper{
         (1, 1, true), 
        RuntimeGeneratedFunctions.RuntimeGeneratedFunction{
              (:___mtkparameters___,), 
              ModelingToolkit.var"#_RGF_ModTag", 
              ModelingToolkit.var"#_RGF_ModTag", 
              (0x6f61882c, 0x8ad26dda, 0x03ef547d, 0x44e7f5b7, 0x6fd8724b), 
              Nothing
              }, 
        RuntimeGeneratedFunctions.RuntimeGeneratedFunction{
             (:ˍ₋out, :___mtkparameters___), 
             ModelingToolkit.var"#_RGF_ModTag", 
             ModelingToolkit.var"#_RGF_ModTag", 
             (0x7ac9c50c, 0x475f4168, 0x6534e784, 0xfba9198a, 0xa6a7a0fc), 
             Nothing}
        }, 
   ModelingToolkit.System, 
   ModelingToolkit.ObservedFunctionCache{ModelingToolkit.System}, 
   Nothing
   }, 
Base.Pairs{
    Symbol, 
    Union{}, 
    Tuple{}, 
    @NamedTuple{}
    }
}, 
::StaticArraysCore.SVector{3, Int64}
)

The function `view` exists, but no method is defined for this combination of argument types.


Closest candidates are:

  view(::ChainRulesCore.AbstractZero, ::Any...)

   @ ChainRulesCore C:\Users\robur\.julia\packages\ChainRulesCore\Vsbj9\src\tangent_types\abstract_zero.jl:44

  view(::RecursiveArrayTools.AbstractVectorOfArray{T, N, <:AbstractVector{T}}, ::Any...) where {T, N, M}

   @ RecursiveArrayTools C:\Users\robur\.julia\packages\RecursiveArrayTools\jieUI\src\vector_of_array.jl:665

  view(::RecursiveArrayTools.AbstractVectorOfArray, ::Any...) where M

   @ RecursiveArrayTools C:\Users\robur\.julia\packages\RecursiveArrayTools\jieUI\src\vector_of_array.jl:676

  ...

Stacktrace

Here is what happened, the most recent locations are first:

    macro expansion
    from 
    code.jl:411
    macro expansion
    from 
    build_function.jl:137
    macro expansion
    from 
    RuntimeGeneratedFunctions.jl:161
    macro expansion
    from 
    generated_callfunc
    from 
    (::RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:out, :__mtk_arg_1, :___mtkparameters___), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xf991b0f9, 0x93d46755, 0x894ab52c, 0x93768f83, 0x3e9f36c6), Nothing})(::Tuple{Vector{Float64}}, ::Vector{Any}, ::ModelingToolkit.MTKParameters{Vector{Float64}, StaticArraysCore.SizedVector{0, Float64, Vector{Float64}}, Tuple{}, Tuple{Vector{Float64}}, Tuple{}, Tuple{Vector{Float64}}})
    from 
    RuntimeGeneratedFunctions → RuntimeGeneratedFunctions.jl:148
    macro expansion
    from 
    codegen_utils.jl
    _generated_call
    from 
    codegen_utils.jl:353
    GeneratedFunctionWrapper
    from 
    codegen_utils.jl:350
    (::ModelingToolkit.CacheWriter{ModelingToolkit.GeneratedFunctionWrapper{(3, 3, true), RuntimeGeneratedFunctions.RuntimeGeneratedFunction{(:out, :__mtk_arg_1, :___mtkparameters___), ModelingToolkit.var"#_RGF_ModTag", ModelingToolkit.var"#_RGF_ModTag", (0xf991b0f9, 0x93d46755, 0x894ab52c, 0x93768f83, 0x3e9f36c6), Nothing}, Nothing}})(p::ModelingToolkit.MTKParameters{Vector{Float64}, StaticArraysCore.SizedVector{0, Float64, Vector{Float64}}, Tuple{}, Tuple{Vector{Float64}}, Tuple{}, Tuple{Vector{Float64}}}, sols::Vector{Any})
    from 
    ModelingToolkit → sccnonlinearproblem.jl:8
    #_#1116(sys::ModelingToolkit.System, op::Dict{…}; eval_expression::Bool, eval_module::Module, cse::Bool, u0_constructor::Function, kwargs::@Kwargs{…}) [...show types...](http://localhost:1234/edit?id=3966e1e0-88b4-11f0-1f03-e14f160c0b7a#)
    from 
    ModelingToolkit → sccnonlinearproblem.jl:269
    ModelingToolkit.InitializationProblem{true, SciMLBase.FullSpecialize}(sys::ModelingToolkit.System, t::Float64, op::Dict{Any, Any}; guesses::Dict{Any, Any}, check_length::Bool, warn_initialize_determined::Bool, initialization_eqs::Vector{Any}, fully_determined::Nothing, check_units::Bool, use_scc::Bool, allow_incomplete::Bool, algebraic_only::Bool, time_dependent_init::Bool, kwargs::@Kwargs{u0_constructor::typeof(identity), p_constructor::typeof(identity), eval_expression::Bool, eval_module::Module, warn_cyclic_dependency::Bool, circular_dependency_max_cycle_length::Int64, circular_dependency_max_cycles::Int64})
    from 
    ModelingToolkit → initializationproblem.jl:138
    InitializationProblem
    from 
    initializationproblem.jl:20
    #_#1098
    from 
    maybe_build_initialization_problem(sys::ModelingToolkit.System, iip::Bool, op::Dict{Any, Any}, t::Float64, defs::Dict{Any, Any}, guesses::Dict{Any, Any}, missing_unknowns::Set{Any}; implicit_dae::Bool, time_dependent_init::Bool, u0_constructor::Function, p_constructor::Function, floatT::Type, initialization_eqs::Vector{Any}, use_scc::Bool, kwargs::@Kwargs{warn_initialize_determined::Bool, eval_expression::Bool, eval_module::Module, fully_determined::Nothing, warn_cyclic_dependency::Bool, check_units::Bool, circular_dependency_max_cycle_length::Int64, circular_dependency_max_cycles::Int64, algebraic_only::Bool, allow_incomplete::Bool})
    from 
    ModelingToolkit → problem_utils.jl:1118
    process_SciMLProblem(constructor::Type, sys::ModelingToolkit.System, op::OrderedCollections.OrderedDict{Any, Any}; build_initializeprob::Bool, implicit_dae::Bool, t::Float64, guesses::Dict{Any, Any}, warn_initialize_determined::Bool, initialization_eqs::Vector{Any}, eval_expression::Bool, eval_module::Module, fully_determined::Nothing, check_initialization_units::Bool, u0_eltype::Nothing, tofloat::Bool, u0_constructor::typeof(identity), p_constructor::typeof(identity), check_length::Bool, symbolic_u0::Bool, warn_cyclic_dependency::Bool, circular_dependency_max_cycle_length::Int64, circular_dependency_max_cycles::Int64, substitution_limit::Int64, use_scc::Bool, time_dependent_init::Bool, algebraic_only::Bool, allow_incomplete::Bool, is_initializeprob::Bool, kwargs::@Kwargs{expression::DataType, check_compatibility::Bool})
    from 
    ModelingToolkit → problem_utils.jl:1382
    (SciMLBase.ODEProblem{true, SciMLBase.FullSpecialize})(sys::ModelingToolkit.System, op::OrderedCollections.OrderedDict{Any, Any}, tspan::Tuple{Float64, Float64}; callback::Nothing, check_length::Bool, eval_expression::Bool, expression::Type, eval_module::Module, check_compatibility::Bool, kwargs::@Kwargs{})
    from 
    ModelingToolkit → odeproblem.jl:81
    ODEProblem
    from 
    odeproblem.jl:73
    ODEProblem
    from 
    ODEProblem
    from 
    macro expansion
    from 
    timing.jl:581
    from 
    [This cell: line 1](http://localhost:1234/edit?id=3966e1e0-88b4-11f0-1f03-e14f160c0b7a#e8b778b9-f27f-485b-b342-d27707e0292a)

    @time "body_prop: " body_prop = ODEProblem(body_sys, body_sys_op, (0.0, 1.0)); #; guesses=guess_dict);

Environment (please complete the following information):

  • Output of using Pkg; Pkg.status()
  Activating project at `C:\Users\  ...  \Notebooks_MTK\Env_MTK10`
Status `C:\Users\  ...  \Notebooks_MTK\Env_MTK10\Project.toml`
  [35d6a980] ColorSchemes v3.30.0
  [5ae59095] Colors v0.13.1
  [e084ae63] CoolProp v0.2.1
  [a93c6f00] DataFrames v1.7.1
  [82cc6244] DataInterpolations v8.6.0
⌅ [864edb3b] DataStructures v0.18.22
  [0c46a032] DifferentialEquations v7.16.1
  [f6369f11] ForwardDiff v1.1.0
  [f7f18e0c] GLFW v3.4.5
  [e9467ef8] GLMakie v0.13.6
  [5c1252a2] GeometryBasics v0.5.10
  [b964fa9f] LaTeXStrings v1.4.0
  [961ee093] ModelingToolkit v10.21.0
  [16a59e39] ModelingToolkitStandardLibrary v2.25.0
  [510215fc] Observables v0.5.5
  [1dea7af3] OrdinaryDiffEq v6.102.0
  [127b3ac7] OrdinaryDiffEqNonlinearSolve v1.14.1
  [91a5bcdd] Plots v1.40.19
  [7f904dfe] PlutoUI v0.7.71
  [94ee1d12] Quaternions v0.7.6
  [f2b01f46] Roots v2.2.10
  [6038ab10] Rotations v1.7.1
  [0bca4576] SciMLBase v2.116.1
  [5c889d49] SkewLinearAlgebra v1.0.0
  [90137ffa] StaticArrays v1.9.15
  [10745b16] Statistics v1.11.1
  [1986cc42] Unitful v1.24.0
  [45397f5d] UnitfulLatexify v1.7.0
  [de0858da] Printf v1.11.0
Info Packages marked with ⌅ have new versions available but compatibility constraints restrict them from upgrading. To see why use `status --outdated`
  • Output of using Pkg; Pkg.status(outdated=true; mode = PKGMODE_MANIFEST)
Status `C:\Users\robur\OneDrive\Documents\Projects\pluto_notebooks\Notebooks_MTK\Env_MTK10\Manifest.toml`
⌅ [861a8166] Combinatorics v1.0.2 (<v1.0.3): SymbolicUtils
⌅ [864edb3b] DataStructures v0.18.22 (<v0.19.1): ModelingToolkit, MultivariatePolynomials, OrdinaryDiffEqCore, StochasticDiffEq, Sundials
⌅ [8fc22ac5] FilePaths v0.8.3 (<v0.9.0): Makie
⌅ [d1acc4aa] IntervalArithmetic v0.22.36 (<v0.23.0): ExactPredicates
⌅ [70703baa] JuliaSyntax v0.4.10 (<v1.0.2): JuliaFormatter
⌃ [7ed4a6bd] LinearSolve v3.28.0 (<v3.39.2)
⌃ [102ac46a] MultivariatePolynomials v0.5.9 (<v0.5.10)
⌅ [aea7be01] PrecompileTools v1.2.1 (<v1.3.3): julia
⌅ [08abe8d2] PrettyTables v2.4.0 (<v3.0.8): DataFrames, DataInterpolations
⌅ [3351c21f] CoolProp_jll v6.8.0+0 (<v7.0.0+0): CoolProp
⌅ [b22a6f82] FFMPEG_jll v6.1.3+0 (<v7.1.1+0): Makie
⌅ [30392449] Pixman_jll v0.44.2+0 (<v0.46.2+0): Cairo_jll
⌅ [fb77eaff] Sundials_jll v5.2.3+0 (<v7.4.1+0): Sundials
  • Output of versioninfo()
Julia Version 1.11.6
Commit 9615af0f26 (2025-07-09 12:58 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 8 × Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, skylake)
Threads: 4 default, 0 interactive, 2 GC (on 8 virtual cores)
Environment:
  JULIA_REVISE_WORKER_ONLY = 1

Additional context

Add any other context about the problem here.

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions