Skip to content

Errors re-rendering quarto html with cached chunks and cmdstanr. #1012

Open
@danmyles

Description

@danmyles

Describe the bug

Quarto fails to re-render to html following trivial changes to code chunks that use cmdstanr objects.

processing file: 01_data-exclusions.qmd
  |............................................... |  98% [model_1_postsum]    
Quitting from lines  at lines 616-637 [model_1_postsum] (01_data-exclusions.qmd)
Error in `read_cmdstan_csv()`:
! Assertion on 'files' failed: File does not exist: '/var/folders/ms/m90tgryx74362fqn7d65tl7w0000gn/T/Rtmp5yoGqf/model_8cda69ac3b06c9b214d4a12ede85f4f8-202407191622-1-7cf94c.csv'.
Backtrace:
 1. fit01$draws(variables = c("a_bar", "sigma", "p"), format = "df")
 2. private$read_csv_(...)
 3. cmdstanr::read_cmdstan_csv(...)
 4. cmdstanr:::assert_file_exists(files, access = "r", extension = "csv")
 5. checkmate::makeAssertion(files, res, .var.name, add)
 6. checkmate:::mstop(...)
                                                                                                                
Execution halted

To Reproduce

Turn on Quarto cache in the header:

...
execute:
   cache: true
...

Read in a stan model from file using the chunk options:

```{cmdstan file = "path/to/stan/model.stan", output.var = 'm01'}
``

Sample:

``` {r}
fit01 <- m01$sample( [...] )
``

Write some code to summarise the model output or whatever.

Render to html.

Make a small change to anything that calls the model fit object fit01. In my case it will happen if I just add an empty line after an unedited chunk.

Try to render to html again.

Error occurs.

Expected behavior
The document is rendered after making small changes without the need to clear the cache and refit all models etc,

Operating system
MacOs 14.0

CmdStanR version number
0.7.1

Additional context
None

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions