Endval issue

Dear all,
I am facing a weird problem by using the initval-endval setup. Dynare is able to compute the initial and final steady state, all reasonable and finite, with 0 residuals in all the equations. But I still face the following warning

Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND =
> In sim1 (line 128)
  In simul (line 126)
  In Reform (line 351)
  In dynare (line 180) 

and error:

Error using sim1 (line 144)
Simulation terminated with NaN or Inf in the residuals or endogenous variables. There is most likely
something wrong with your model.
Error in simul (line 126)

Any idea on what is going on?
Thank you in advance.

That means there is a problem in finding the optimal transition path. Could you please provide me with the file?