Unable to compile stan model using cmdstanr 2.29.2

I downgraded to R 4.1.3 and rtools40 and the model is able to compile.

However, doing this has brought back the other issue I have when running the sampling:

model <- cmdstan_model(file.path(cmdstan_path(), "examples/bernoulli/bernoulli.stan"))
model$compile(force_recompile = T)
model$sample(data = list(N=10, y=rbinom(10, 1, 0.5)), refresh = 0)
Running MCMC with 4 sequential chains...

Chain 1 finished in 0.0 seconds.
Chain 2 finished in 0.0 seconds.
Chain 3 finished in 0.0 seconds.
Chain 4 finished in 0.0 seconds.

All 4 chains finished successfully.
Mean chain execution time: 0.0 seconds.
Total execution time: 0.6 seconds.

'""' is not recognized as an internal or external command,
operable program or batch file.
 Error: Supplied CSV file is corrupt!

(not sure which forum post I should use at this point, for now I will use this one)

Running model$diagnose() returns:

method = diagnose
  diagnose
    test = gradient (Default)
      gradient
        epsilon = 9.9999999999999995e-07 (Default)
        error = 9.9999999999999995e-07 (Default)
id = 1 (Default)
data
  file =  (Default)
init = 2 (Default)
random
  seed = 1437217597
output
  file = C:/Users/gscot/AppData/Local/Temp/Rtmp82BOvb/bernoulli-202206281236-1-7cc405.csv
  diagnostic_file =  (Default)
  refresh = 100 (Default)
  sig_figs = -1 (Default)
  profile_file = C:/Users/gscot/AppData/Local/Temp/Rtmp82BOvb/bernoulli-profile-202206281236-1-77cc55.csv
num_threads = 1 (Default)

method = diagnose
  diagnose
    test = gradient (Default)
      gradient
        epsilon = 9.9999999999999995e-07 (Default)
        error = 9.9999999999999995e-07 (Default)
id = 1 (Default)
data
  file =  (Default)
init = 2 (Default)
random
  seed = 1437217597
output
  file = C:/Users/gscot/AppData/Local/Temp/Rtmp82BOvb/bernoulli-202206281236-1-7cc405.csv
  diagnostic_file =  (Default)
  refresh = 100 (Default)
  sig_figs = -1 (Default)
  profile_file = C:/Users/gscot/AppData/Local/Temp/Rtmp82BOvb/bernoulli-profile-202206281236-1-77cc55.csv
num_threads = 1 (Default)

 Error: Diagnose failed with the status code 1!
See the output above for more information.

The diagnostics output file C:/Users/gscot/AppData/Local/Temp/Rtmp82BOvb/bernoulli-202206281236-1-7cc405.csv does not exist, but a file named bernoulli-202206281232-2-217e9c.csv does exist in that folder.

If I try running read_cmdstan_csv("C:/Users/gscot/AppData/Local/Temp/Rtmp82BOvb/bernoulli-202206281232-2-217e9c.csv") I get the error from before

'""' is not recognized as an internal or external command,
operable program or batch file.
 Error: Supplied CSV file is corrupt!

I can read the sample results using readr::read_csv("C:/Users/gscot/AppData/Local/Temp/Rtmp82BOvb/bernoulli-202206281232-2-217e9c.csv", col_names = F)

Here’s the sample result csv file:
bernoulli-202206281232-2-217e9c.csv (49.6 KB)

I could technically make this work by cleaning the results manually but I’d prefer to resolve this issue if possible