For a one factor model, I would usually declare the loadings to be unconstrained in the parameters
block and in the generated quantities
block, multiply stuff by -1 as necessary to force the sign of one loading to be positive.
For a multi-factor model with an identity matrix for the correlations among the factors, a cholesky_factor_cov
can work well as a loadings matrix since it is lower trapezoidal with positive diagonal entries. But that can run into problems like the one you encountered, if for example, the first manifest variable has little signal.
For a multi-factor model with correlated factors, it is harder. One option would be to use a positive_ordered
type for the factor variances and restrict some loading on each factor to be 1. But that too can run into problems if two of the factor variances are close together.
This problem is quite similar to the one discussed in the mixture case study
http://mc-stan.org/users/documentation/case-studies/identifying_mixture_models.html