Weird error message with stan()

Hi everyone, I have a very weird bug on Stan, where I cannot run my model and I cannot figure out why. I get the following error message:

Error in stanc(file = file, model_code = model_code, model_name = model_name,  : 

Syntax error in 'string', line 16, column 33, lexing error:

Invalid character found.

I think the error pertains to the path of my stan model file, but I tried multiple ways of expressing it and it never works. Does anyone have any idea what could be causing this? (Yes, I tried to uninstall and reinstall the package). This is the code I run:

stan.model <- stan(file = model.path, data =

That error is for a syntax error in your Stan code

But I can’t understand what it could be, also line 14 is an empty line. This is the very simple code of the model I am using. Whenever I get errors in the model, I usually get a different error message.

data {
  int<lower=0> N;              // num observations
  vector[N] y;                 // outcome
  vector[N] se;                // vector of standard error estimates

parameters {
  real t;                     // common mean for the theta's
  vector[N] theta;            // vector of RCT-specific ATE's
  real<lower=0,upper=pi()/2> sigma.theta.unif;

transformed parameters {

  // Here we use the fact that if X is uniformly distributed on an appropriate
  // support (0, pi/2), then Y=tan(X) is distributed as a half-Cauchy random 
  // variable. We perform this transformation because is computationally more 
  // efficient for Stan to sample from a uniform than from a Cauchy with thick
  // tails.
  real<lower=0> sigma.theta = tan(sigma.theta.unif);

model {
  // Likelihood or 1st hierarchical layer
  y ~ normal(theta, se);
  // 2nd hierarchical layer
  theta ~ normal(t, sigma.theta);
  // 3rd hierarchical layer
  t ~ normal(0,2);
  sigma.theta.unif ~ uniform(0,pi()/2);

Drop to dots in variable names.

Yes I figured, it’s weird that it’s not allowed. Thanks a lot for the help.