Gradient evaluated at the initial value is not finite

Hi all,

I am receiving this error :
Chain 1: Rejecting initial value:
Chain 1: Gradient evaluated at the initial value is not finite.
Chain 1: Stan can’t start sampling from this initial value.

My model is as follows:

    data {
        int D;
        vector[D] U;
        vector[D] X;
        vector[D] M;
  parameters {
       real<lower=0> location_U;
       real<lower=0> scale_U;
       real<lower=0> shape_U;
       real<lower=0> scale_X;
       real<lower=0> shape_X;
       real<lower=0> scale_M;
       real<lower=0> shape_M;
       real<lower=0> beta_0_X;
       real<lower=0> beta_U_to_X;
       real<lower=0> beta_0_M;
       real<lower=0> beta_X_to_M;
  transformed parameters {
       vector<lower=0>[D] location_X;
       vector<lower=0>[D] location_M;
       for (i in 1:D){
         location_X[i] = beta_0_X + U[i] * beta_U_to_X; 
         location_M[i] = beta_0_M + X[i] * beta_X_to_M;

    model {
        //prior over parameters
        location_U  ~ normal(10, 10);
        scale_U  ~ normal(10, 10);
        shape_U  ~ normal(10, 10);
        beta_0_X  ~ normal(10, 10);
        beta_U_to_X  ~ normal(10, 10);
        scale_X  ~ normal(10, 10);
        shape_X  ~ normal(10, 10);
        beta_0_M  ~ normal(10, 10);
        beta_X_to_M  ~ normal(10, 10);
        scale_M  ~ normal(10, 10);
        shape_M  ~ normal(10, 10);
        U ~ skew_normal(location_U, scale_U, shape_U);
        X ~ skew_normal(location_X, scale_X, shape_X);
        M ~ skew_normal(location_M, scale_M, shape_M);

I don’t receive this message when only U, and X are in my model. But as soon as I add M, I will receive this error. Does anyone know what is causing this issue?

Have you checked that the transformed parameters for M take on reasonable values? Looks like it might just be a peek with input data