Already the residual evaluation resulted in NaNs.
Some of your problem functions are not defined for the initial guess.
More specifically, the stationarity residual is NaN, so your model equations are not well defined for the initial guess.
You probably need to initialize the solver more carefully.

I guessed that it has to do something with the initialization, but I do not see what I did wrong during the initialization. At least now I can be sure that it has something to do with the initialization. I will recheck and write again

As a suggestion I would introduce more specific return values. Just an ACADOS_FAILURE is not really helpful for debugging.

renamed the status as you requested to ACADOS_NAN_DETECTED

set the guess for z in the integrator also when initializing z.
The example now works!

I am honestly a bit though surprised that the other version works, i.e. solving an OCP with initial state 0.0, where you divide by x within your dynamic model equations.
I think one should really be a bit careful dividing by some numbers within a model used in SQP.

Ah that is true. That is weird. That should not work then, may that be a bug?
If I print the solution of the first stage of x I get: array([0.]). I am not sure if this number is rounded maybe it is just really small. Actually, this should cause an NaN in some matrices and thus result in an error.

I don’t think it is a bug.
In the implicit RK used the ODE is never evaluated at x0, so it is able to find a solution, but still the problem is not well defined formally.