Hi,

I tried the model in

and it stuck when running MCMC and produced the error Supplied CSV file is corrupt!

```
fit <- mod$sample(
data = data_list,
seed = 123,
chains = 4,
parallel_chains = 4,
refresh = 500 # print update every 500 iters
)
```

Reinstallation seems not work.

I don’t understand what does this error mean, and what caused the problem

Hope someone can help!

- Operating System: I use R on windows and installed CmdStanR with WSL.
- CmdStan Version: wsl-cmdstan-2.31.0
- Compiler/Toolkit: R studio

Through function tempdir() I can find a temp folder where has the .csv file with the generated chains. But I have no idea what I can do next.

Hi, @Copula_H. Is there any way you could give us more context, specifically the rest of the code you ran and the exact output you saw? The only .csv file is produced programatically on output, so that shouldn’t be corrupted unless something interrupted the process creating it midstream.

@Bob_Carpenter Thanks for your reply.

```
file <- file.path(cmdstan_path(), "examples/bernoulli/bernoulli.stan")
mod <- cmdstan_model(file)
mod$print()
stan_data <- list(N = 10, y = c(0,1,0,0,0,0,0,0,0,1))
fit_mcmc <- mod$sample(
data = stan_data,
seed = 123,
chains = 2,
parallel_chains = 2
)
```

I use the example from the website. At the last step mod$sample, I got the output

```
Running MCMC with 2 parallel chains...
Chain 1 Iteration: 1 / 2000 [ 0%] (Warmup)
Chain 1 Iteration: 100 / 2000 [ 5%] (Warmup)
Chain 1 Iteration: 200 / 2000 [ 10%] (Warmup)
Chain 1 Iteration: 300 / 2000 [ 15%] (Warmup)
Chain 1 Iteration: 400 / 2000 [ 20%] (Warmup)
Chain 1 Iteration: 500 / 2000 [ 25%] (Warmup)
Chain 1 Iteration: 600 / 2000 [ 30%] (Warmup)
Chain 1 Iteration: 700 / 2000 [ 35%] (Warmup)
Chain 1 Iteration: 800 / 2000 [ 40%] (Warmup)
Chain 1 Iteration: 900 / 2000 [ 45%] (Warmup)
Chain 1 Iteration: 1000 / 2000 [ 50%] (Warmup)
Chain 1 Iteration: 1001 / 2000 [ 50%] (Sampling)
Chain 1 Iteration: 1100 / 2000 [ 55%] (Sampling)
Chain 1 Iteration: 1200 / 2000 [ 60%] (Sampling)
Chain 1 Iteration: 1300 / 2000 [ 65%] (Sampling)
Chain 2 Iteration: 1 / 2000 [ 0%] (Warmup)
Chain 2 Iteration: 100 / 2000 [ 5%] (Warmup)
Chain 2 Iteration: 200 / 2000 [ 10%] (Warmup)
Chain 2 Iteration: 300 / 2000 [ 15%] (Warmup)
Chain 2 Iteration: 400 / 2000 [ 20%] (Warmup)
Chain 2 Iteration: 500 / 2000 [ 25%] (Warmup)
Chain 2 Iteration: 600 / 2000 [ 30%] (Warmup)
Chain 2 Iteration: 700 / 2000 [ 35%] (Warmup)
Chain 2 Iteration: 800 / 2000 [ 40%] (Warmup)
Chain 2 Iteration: 900 / 2000 [ 45%] (Warmup)
Chain 2 Iteration: 1000 / 2000 [ 50%] (Warmup)
Chain 2 Iteration: 1001 / 2000 [ 50%] (Sampling)
Chain 2 Iteration: 1100 / 2000 [ 55%] (Sampling)
Chain 2 Iteration: 1200 / 2000 [ 60%] (Sampling)
Chain 2 Iteration: 1300 / 2000 [ 65%] (Sampling)
Chain 1 Iteration: 1400 / 2000 [ 70%] (Sampling)
Chain 1 Iteration: 1500 / 2000 [ 75%] (Sampling)
Chain 1 Iteration: 1600 / 2000 [ 80%] (Sampling)
Chain 2 Iteration: 1400 / 2000 [ 70%] (Sampling)
Chain 2 Iteration: 1500 / 2000 [ 75%] (Sampling)
Chain 2 Iteration: 1600 / 2000 [ 80%] (Sampling)
Chain 1 Iteration: 1700 / 2000 [ 85%] (Sampling)
Chain 1 Iteration: 1800 / 2000 [ 90%] (Sampling)
Chain 2 Iteration: 1700 / 2000 [ 85%] (Sampling)
Chain 2 Iteration: 1800 / 2000 [ 90%] (Sampling)
Chain 1 Iteration: 1900 / 2000 [ 95%] (Sampling)
Chain 1 Iteration: 2000 / 2000 [100%] (Sampling)
Chain 2 Iteration: 1900 / 2000 [ 95%] (Sampling)
Chain 2 Iteration: 2000 / 2000 [100%] (Sampling)
Chain 1 finished in 0.5 seconds.
Chain 2 finished in 0.5 seconds.
Both chains finished successfully.
Mean chain execution time: 0.5 seconds.
Total execution time: 0.8 seconds.
'""' is not recognized as an internal or external command,
operable program or batch file.
Error: Supplied CSV file is corrupt!
```

Then the fit_mcmc is not available since the error exists.

How many csv files can be found in the temp folder? I wonder if different models were sampled to a same folder and CmdStanR fails to read all of them.

We had similar error in CmdStanPy (cc @WardBrian @mitzimorris )

I currently have two files.

@ahartikainen

Does the error occur if you use cmdstan which is not installed in WSL?

What do those two files contain? Can you upload them somewhere like gist.github.com?

@WardBrian Temp files for binomial example in cmdstanR · GitHub the files in the temp folders are uploaded in the gist. Please kindly check that, thank you so much.

I will try windows version later, and I will let you know if I have any update.

Huh, that’s odd. I can load those csv files into cmdstanpy just fine, no error produced. It seems like they’re valid files.

Looking at your above post, the line

```
'""' is not recognized as an internal or external command,
operable program or batch file.
```

is suspect. It seems like cmdstanr is trying to run an empty command, and that’s the source of the failure. Pinging @andrjohns

@WardBrian

I installed the windows version of cmdstan. There is no error now.

However I don’t really know which version is currently working , since there are two cmdstan.

@WardBrian Thanks!

I checked the path and it is on wsl-cmdstan-2.31.0. It means I am still using the wsl version but the error disappears. When I changed the path to cmdstan-2.31.0 which is the windows version, it produced some other errors but not the same one.

Is it possible the error “Supplied CSV file is corrupt!” is related to Rtools? When I installed windows version, it also installed Rtools for me, which I didn’t have with wsl version. I have now removed cmdstan-2.31.0 and it is all good.

It seems likely that it was trying to run some program that didn’t exist, so installing RTools could have fixed this yes