I tried a test case from Octave ode15i tests and get the error:

[IDAS ERROR] IDAGetDky

Illegal value for k.┌ Warning: IDAGetDky failed with error code =

│ flag = -25

└ @ Sundials ~/.julia/dev/Sundials/src/simple.jl:20

The error happens with “save_everystep=true” option. With “save_everystep=false” the error does not happen.

The test should have two events, the second event terminates the problem.

When the error happens the second event is not detected. Without the error both events are detected. Could the problem be with IDA or DiffEq?

I recall having tested this some time ago (>year) and I think at that time it worked with save_everystep=true option, but I don’t have the version of DiffEq used at that time.

This is with Julia 1.5.3 and “[0c46a032] DifferentialEquations v6.15.0”

Below the code to test this:

```
import DifferentialEquations
const DiffEq = DifferentialEquations
function rob(t, u, du)
res =[-(du[1] + 0.04*u[1] - 1e4*u[2]*u[3]),
-(du[2] - 0.04*u[1] + 1e4*u[2]*u[3] + 3e7*u[2]^2),
u[1] + u[2] + u[3] - 1]
return res
end
function event1(t, u, du)
if (t < 1e1)
val = -1
else
val = 1
end
return val
end
function event2(t, u, du)
if (t < 1e1)
val = -2
else
val = 3
end
return val
end
ode_rob = (out, du, u, p, t) -> (out[:] .= rob(t, u, du); out)
dae_f = DiffEq.DAEFunction(ode_rob)
tspan = (0.0, 100.0)
u0 = [1.0, 0.0, 0.0]
du0 = [-1e-4, 1e-4, 0.0]
differential_vars = [true, true,true]
dae_prob = DiffEq.DAEProblem(dae_f, du0, u0, tspan; differential_vars)
cond1 = (u, t, integrator) -> event1(t, u, DiffEq.get_du(integrator))
cond2 = (u, t, integrator) -> event2(t, u, DiffEq.get_du(integrator))
affect1 = (integrator)-> (println("Event 1 at time: $(integrator.t)"); integrator)
affect2 = (integrator)-> (println("Event 2 at time: $(integrator.t)"); DiffEq.terminate!(integrator))
cb1 = DiffEq.ContinuousCallback(cond1, affect1, nothing)
cb2 = DiffEq.ContinuousCallback(cond2, affect2)
cb_set = DiffEq.CallbackSet(cb1, cb2)
println("Sol 1")
sol1 = DiffEq.solve(dae_prob, DiffEq.IDA(); save_everystep=false,callback=cb_set)
println("Sol 2")
sol2 = DiffEq.solve(dae_prob, DiffEq.IDA(); save_everystep=true,callback=cb_set)
```