diff --git a/src/solver.cpp b/src/solver.cpp index 5c96855d97..7dc3980c5c 100644 --- a/src/solver.cpp +++ b/src/solver.cpp @@ -1205,6 +1205,7 @@ void Solver::initializeNonLinearSolverSens(Model const* model) const { } void Solver::setErrHandlerFn() const { + SUNContext_ClearErrHandlers(sunctx_); auto sunerr = SUNContext_PushErrHandler( sunctx_, wrapErrHandlerFn, reinterpret_cast(const_cast(this))