I am also experiencing the same problem. My script was working fine until suddenly I started receiving the same error. Any Idea on how to solve the problem?

for (i in 1:N)
log_lik[i] = ordered_logistic_lpmf(y[i] | x[i] * beta, c);

#int<lower=1,upper=K> y_pred[N];
#for (i in 1:N)
#y_pred[i] = ordered_logistic_rng(x[i] * beta, c);

}

r code
K = length(unique(ytr))
N = length(ytr)
x_data = as.data.frame(tr[,c(-1,-5)])
x = model.matrix(~ ., x_data) #design matrix
D=ncol(x)
library(rstan) #to fit models with Stan
my_data = list( K = K, N = N, y = ytr, x = x,D=D) # data to be passed to Stan

fit1 = stan(file = ‘Trolley22.stan’, data = my_data) #fit the model