Dimension of the data

I have the following stan model, but it seems it works only when the ndose>1. Anyway I can work around this so the same model can handle both when ndose=1 and ndose>1?

Stan code:

data {
  int<lower=0> ndose;
  real doses[ndose];
  int n[ndose];
  int n_dlt[ndose];
  vector[2] mprior; // prior for log_alpha and log_beta (blrm.stan model beta instead)
  matrix[2,2] vprior;
parameters {
  vector[2] lparam;
model {
  // lparam ~ multi_normal(mprior, vprior);
  for (i in 2:ndose){
    target += binomial_logit_lpmf(n_dlt[i]|n[i], lparam[1] + exp(lparam[2])*log(doses[i]/doses[1]));
generated quantities{
  real postprob[ndose];
  for (i in 1:ndose){
    postprob[i]= exp(lparam[1] + exp(lparam[2])*log(doses[i]/doses[1]))/(1+exp(lparam[1] + exp(lparam[2])*log(doses[i]/doses[1])));

You have a for-loop that begins from i=2, and then inside that loop you have a term log(doses[i]/doses[1]). What is the desired behavior for a model for just one dose?

it is the same. I changed the loop starting from i=1. Still get the following messages

Error in mod$fit_ptr() :
Exception: mismatch in number dimensions declared and found in context; processing stage=data initialization; variable name=doses; dims declared=(1); dims found=() (in ‘model44614a0a0f7_blrm2’ at line 3)