Model convergence issues with growth curve model

I am trying to estimate a growth curve model, however, despite numerous attempts I have not been able to optimise the model. I keep getting the following warnings:

1: There were 6349 divergent transitions after warmup. See
https://mc-stan.org/misc/warnings.html#divergent-transitions-after-warmup
to find out why this is a problem and how to eliminate them.
2: Examine the pairs() plot to diagnose sampling problems

3: Bulk Effective Samples Size (ESS) is too low, indicating posterior means and medians may be unreliable.
Running the chains for more iterations may help. See
https://mc-stan.org/misc/warnings.html#bulk-ess

data {
  int<lower=1> N;                    // Number of respondents
  int<lower=1> T;                    // Number of time periods
  matrix[N, T] Y;                    // Outcome variable matrix
  matrix[N, T] M;                    // Mediator variable matrix
  real<lower=0> time[N, T];          // Time values
  vector[N] W;                       // Moderator variable vector
}

parameters {
  vector[N] alpha_raw;               // Raw intercept for each individual
  vector[N] beta_raw;                // Raw slope for each individual
  real beta_mediator;                // Coefficient for mediator variable
  real<lower=0> sigma;               // Residual standard deviation
  real<lower=0> sigma_alpha;         // Prior std for alpha
  real<lower=0> sigma_beta;          // Prior std for beta
  real<lower=0> sigma_med;           // Prior std for mediator
  real<lower=0> sigma_growth;        // Prior std for growth parameters
  real growth;                       // Growth parameter
}

transformed parameters {
  vector[N] alpha;                   // Transformed intercept for each individual
  vector[N] beta;                    // Transformed slope for each individual

  alpha = alpha_raw * sigma_alpha;
  beta = beta_raw * sigma_beta;
}

model {
  // Priors
  alpha_raw ~ normal(0, 1);         // Prior for raw intercept
  beta_raw ~ normal(0, 1);          // Prior for raw slope
  beta_mediator ~ normal(0, sigma_med); // Prior for mediator coefficient
  sigma ~ cauchy(0, 2.5);           // Prior for residual standard deviation
  growth ~ normal(0, sigma_growth);  // Prior for growth parameter

  // Likelihood
  for (n in 1:N) {
    for (t in 1:T) {
      real mu;
      mu = alpha[n] + beta[n] * time[n, t] + beta_mediator * M[n, t] + growth * time[n, t] + W[n];
      Y[n, t] ~ normal(mu, sigma);
    }
  }
}

generated quantities {
  // Extracting the log-likelihood for diagnostics
  vector[N * T] log_lik;
  int idx = 1;
  for (n in 1:N) {
    for (t in 1:T) {
      log_lik[idx] = normal_lpdf(Y[n, t] | alpha[n] + beta[n] * time[n, t] + beta_mediator * M[n, t] + growth * time[n, t] + W[n], sigma);
      idx += 1;
    }
  }
}

I appreciate any and all help with this. Thanks in advance!

The sigma_med and sigma_growth standard deviations of the normal distributions are uniform improper priors with support over the range [0,inf). That leaves the mediator multipliers, beta_mediator and growth, pretty much unconstrained over (-inf,inf). alpha and beta are similarly each the product of parameters drawn from a normal and an improper uniform prior with support over [0,inf), where alpha is an additivie term and beta is yet another multiplier in the linear function that defines mu. That leaves the prior on Y with a mean that has a pretty much unconstrained domain over (-inf,inf), and a standard deviation, sigma, that is drawn from the heavy-tailed cauchy distribiution.

I am not a modeling expert, but you haven’t been answered in a while and this strikes me as a posterior geometry that the sampler would have a very hard time with.