Internal error: during type inference Encountered stack overflow. This might be caused by recursion over very long tuples or argument lists

Julia Version : 1.11.4+0.aarch64.apple.darwin14
Related package: ModelingToolkit, NonlinearSolve

Our project is to use C++ to pass function parameter information to Julia, then use julia to implement numerical calculations, and finally return the results to C++.
In our call calculation, a stack overflow is prompted during the first call to the function,
Internal error: during type inference Encountered stack overflow. This might be caused by recursion over very long tuples or argument lists.
but the julia process calculates and returns the result normally.
From the second call onwards, there will be no access to the Julia process, only C++ related logs. The stack overflow warning still exists
Internal error: during type inference Encountered stack overflow. This might be caused by recursion over very long tuples or argument lists.
Finally the error is reported
[51768] signal 11 (2): Segmentation fault: 11 in expression starting at none:0 Allocations: 124270666 (Pool: 124266799; Big: 3867); GC: 1 zsh: segmentation fault ./web_simulation_test

Julia function :
const ValueType = Union{Float64, Array{Float64, 1}, Array{Float64, 2}, Array{Float64, 3}}
function source_model( namelist::Vector{String}, params_list::Dict{String, ValueType}, fixed_vars::Dict{String, ValueType}, guess_vars::Dict{String, ValueType}; thermo_model::String="SRK", solver::String="NewtonRaphson", log_level::LogLevel=DEBUG )

C++ calling function :
std::string call_code =
"global cpp_result = nothing; try\n"
"global cpp_result = Julia_Model." +
function_name +
"(cpp_namelist, "
"cpp_params_list, cpp_fixed_vars, cpp_guess_vars, \"" +
thermodynamic_model + "\", \"" + solver_name +
"\")\n"
"println(\"调用成功: \", typeof(cpp_result))\n"
"catch e\n"
"println(\"调用错误: \", e)\n"
"bt = stacktrace(catch_backtrace())\n"
"println(\"栈跟踪: \", bt)\n"
"end";

jl_eval_string(call_code.c_str());
jl_value_t *result = jl_eval_string("cpp_result");

I’ve submitted the corresponding issue on github #58096
I’ll provide as much info as I can if needed
Calculations are not working causing our project to stall badly, hopefully someone will be able to help us soon!

Julia_Model is our pre-compiled Julia package, where all of our computation-related functions are located

The problem has been solved.
The cause appeared to be: since it was multiple model functions being called consecutively, there was a stack overflow when subsequent models were accessed due to the previous model system failing to build via MTK. Although the type inference problem persisted throughout, it did not affect the normal computation of julia. After debugging to ensure that each model can be constructed normally via MTK, it is guaranteed that it can be calculated continuously, so the problem is solved!