# Error when compiling Stan program through brms

**URL:** <https://discourse.mc-stan.org/t/error-when-compiling-stan-program-through-brms/20300>\
**Category:** brms\
**Tags:** compiler, rstan, brms\
**Created:** [January 19, 2021, 2:50am UTC](https://discourse.mc-stan.org/t/error-when-compiling-stan-program-through-brms/20300 "2021-01-19T02:50:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![YidaZhang0628](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/yidazhang0628/32/10105_2.png) [@YidaZhang0628](https://discourse.mc-stan.org/u/YidaZhang0628)\
**Post date:** [January 19, 2021, 2:50am UTC](https://discourse.mc-stan.org/t/error-when-compiling-stan-program-through-brms/20300/1 "2021-01-19T02:50:16Z")

</div>

I have been using brms for a while in R 3.5.3. A few days ago, the R on our server got upgraded to R 4.0.3. I installed brms in the new R through CRAN without any problem. However, when I tried the example code in [Estimating Distributional Models with brms](https://cran.r-project.org/web/packages/brms/vignettes/brms_distreg.html#zero-inflated-models), I got an error when compiling the code (see attached screenshot below). My suspect is that this may be due to version issues but I don’t know the source of this. Does anybody have any idea?

![Screen Shot 2021-01-18 at 9.45.07 PM](https://canada1.discourse-cdn.com/flex030/uploads/mc_stan/original/2X/c/c11d8d871011115f8adf7c8a423d9c1fccaa4322.png)

Below is the code (the same with the code in the link):

```
library(brms)
group <- rep(c("treat", "placebo"), each = 30)
symptom_post <- c(rnorm(30, mean = 1, sd = 2), rnorm(30, mean = 0, sd = 1))
dat1 <- data.frame(group, symptom_post)
fit1 <- brm(bf(symptom_post ~ group, sigma ~ group), 
            data = dat1, family = gaussian())

```

Here is the session info:

 ![Screen Shot 2021-01-18 at 9.48.43 PM](https://canada1.discourse-cdn.com/flex030/uploads/mc_stan/original/2X/3/3cb018b813d0b4735f7aedafd286b03b0262b71c.png)

- Operating System: Linux
- brms Version: brms\_2.14.4

---

<div class="post-metadata">

**Author:** ![andrjohns](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/andrjohns/32/15297_2.png) [@andrjohns](https://discourse.mc-stan.org/u/andrjohns)\
**Post date:** [January 19, 2021, 4:04am UTC](https://discourse.mc-stan.org/t/error-when-compiling-stan-program-through-brms/20300/2 "2021-01-19T04:04:37Z")

</div>

Hi Yida,

The first thing to try is to restart R and reinstall RStan and StanHeaders from source:

```
install.packages(c("StanHeaders","rstan"),type="source")

```

If that doesn’t work, can you post the output from:

```
devtools::session_info("rstan")

```

---

<div class="post-metadata">

**Author:** ![YidaZhang0628](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mc-stan.org/yidazhang0628/32/10105_2.png) [@YidaZhang0628](https://discourse.mc-stan.org/u/YidaZhang0628)\
**Post date:** [January 19, 2021, 3:13pm UTC](https://discourse.mc-stan.org/t/error-when-compiling-stan-program-through-brms/20300/3 "2021-01-19T15:13:18Z")

</div>

It works! Can I ask what is the reason for this error? Thanks!
