I tried to run ireland.mod, an example included in snapshot version, which is maximum likelihood estimation following ireland (2004).

The thing is the optimization is terminated with a warning message.

205 4853 -2329.27 -0.003391 0.00391 -2.46e-006 19.3 Hessian modified twice
206 4875 -2329.27 -0.003391 1 -7.49e-008 10.8
Optimization terminated: magnitude of search direction less than 2*options.TolX
and maximum constraint violation is less than options.TolCon.
No active inequalities.
Warning: Matrix is close to singular or badly scaled.
Results may be inaccurate. RCOND = 8.143325e-023.

In dynare_estimation at 399
In ireland4 at 202
In dynare at 26

I checked dynare_estimation at 399 ,
399: invhess = inv(hh);
it seems it is an inverse of Hessian matrix.

What could cause this? Can I just ignore this warning message?

You may have a problem with your ML estimate. In the linear model y = X*b + e you could translate this warning as “X’*X is near singular” meaning that you have a problem of near co-linearity or identification. You should try to maximize the likelihood with another optimization routine or to re-start chris sims’ optimization routine (mode_compute=4, the default option).

I know there is a problem of stochastic singularity if there is only one shock in the model. I thought this problem can be solved by adding measurement errors. I am wondering why there is still a problem of singularity after adding measurement error. Why csminwel is better than
fmincon to deal with this problem?

Here you do not have a problem of stochastic singularity. If you do not have enough shocks, ie less shocks (structural or ad hoc), you cannot even write the likelihood (a fortiori you cannot maximize it). This is a stochastic singularity problem.

I believe that in your case the optimization algorithm probably didn’t get the maximum likelihood or the likelihood is not well behaved (I mean nearly flat in some directions). That’s why you should try other routines, or (re)start the same from the previous estimate of the ML (simply by adding mode_file = <NAME_OF_YOUR_MOD_FILE>_mode in the estimation
command).

csminwell is not always better than fmincon. The best optimization routine is model and data dependent.