Error in unserialize(socklist[[n]]) : error reading from connection

  • Operating System: x86_64-apple-darwin17.0
    R version 4.1.2 (2021-11-01)
  • brms Version: most recent

I am trying to just get started on brms, so am new to it. I think I am having problems with Rstan. I built a very simple model and tried to run it, and keep getting the error: Error in unserialize(socklist[[n]]) : error reading from connection. If I change the number of cores to 1, then R crashes.

 b1.1 <- brm(meanAGB ~ 1 + (1 | NRI), 
             data   = mdat, 
             warmup = 100, 
             iter   = 200, 
             chains = 2, 
             init  = "random",
             cores  = 2) 

Compiling Stan program…
Start sampling
starting worker pid=26025 on localhost:11580 at 14:14:31.266
starting worker pid=26039 on localhost:11580 at 14:14:31.545

SAMPLING FOR MODEL ‘1774cb59f8cb5de631ac8a11c95aad24’ NOW (CHAIN 1).
Error in unserialize(socklist[[n]]) : error reading from connection
Warning message:
package ‘StanHeaders’ was built under R version 4.1.3

Here is a sample of the data…

meanAGB <-c(260.621,237.649,382.267,243.735,407.890,313.789,259.498,393.315,170.895,157.022,235.204,289.888,252.817,308.665,372.554,265.396,319.917,268.139,253.813,5.892,250.257,246.370,311.045,345.918,172.193,283.400,0.309,285.171,160.748,405.803,125.188,334.036,438.075,413.380,297.553,411.127,161.164,227.803,160.865,490.476,349.094,9.756,450.329,250.341,251.062,199.777,111.254,2.365,359.228,250.648)

NRI <-c(“NRI”,“NRI”,“NRI”,“NRI”,“NRI”,“NRI”,“NRI”,“NRI”,“NRI”,“NRI”,“NRI”,“NRI”,“NRI”,“NRI”,“NRI”,“NRI”,“NRI”,“NRI”,“0”,“0”,“NRI”,“NRI”,“NRI”,“NRI”,“NRI”,“0”,“0”,“0”,“0”,“NRI”,“NRI”,“NRI”,“NRI”,“NRI”,“0”,“0”,“NRI”,“0”,“0”,“0”,“NRI”,“NRI”,“NRI”,“NRI”,“NRI”,“NRI”,“NRI”,“NRI",“0”)

As a follow-up, I removed R, R Studio, and reloaded RStan, and got it working.

I am having the exact same problem on two machines: MacBook pro m1 and MacBook pro with intel chip. I started getting this error after updating RStudio to the latest versions on both computers.

You re-installed R and RStudio, and it solved the problem?