stan-dev / stan-dev/rstan

error with already compiled stored models

Open
#967 6 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
1.1k
Forks
266
Avg merge
2h 56m
Merged PRs (30d)
1

Description

Summary:

I'm getting an error quite often when the rds of a model is saved.

Description:

This:

N <- 10000
mu <- .002
sigma <- .0004
rt <- 1/rnorm(N, mu, sigma) 
fit_rec <- stan(normal_recrt.stan, data = list(N = N, recRT = 1/rt))

If the model was already ran (and stored), sometimes produces this error.

Error in if (!file.exists(file.rds) || (mtime.rds <- file.info(file.rds)$mtime) <  : 
  missing value where TRUE/FALSE needed

Here is the model and the stored model in rds: normal_recrt.zip

Reproducible Steps:

I cannot really reproduce it, it just happens and then I remove the rds file and continues working. I'm mostly running the models as part of a bookdown, and I get that error a lot!. But once I get it, the stan() command will give me errors until I delete the rds file.

RStan Version:

‘2.26.3’

R Version:

R version 4.1.1 (2021-08-10)

Operating System:

Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.3 LTS

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the stan() call and the supplied normal_recrt.zip reproduction, then trace how an already stored model is checked before reuse. Investigate the file.exists/file.info condition shown in the error and verify behavior on the listed RStan, R, and Ubuntu versions; done means the stored-model path no longer fails, or the failure has a reliable reproduction.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.