Rstan failed to create sampler without error message


#1

I had a model that was working, but then I added a generated quantities block and new data so I could get predictions. When I did this I got the error

failed to create the sampler; sampling not done

There was no other information provided, making this problem difficult to debug.

  • Operating System - Linux

  • RStan Version - 2.17.3

  • Output of writeLines(readLines(file.path(Sys.getenv("HOME"), ".R/Makevars")))

    CXXFLAGS=-O3 -mtune=native -march=native -Wno-unused-variable -Wno-unused-function -Wno-macro-redefined

    CXXFLAGS += -Wno-ignored-attributes -Wno-deprecated-declarations

  • Output of devtools::session_info("rstan")

    setting value
    version R version 3.5.1 (2018-07-02)
    system x86_64, linux-gnu
    ui RStudio (1.1.447)
    language (EN)
    collate en_US.UTF-8
    tz America/New_York
    date 2018-07-08

    package * version date
    assertthat 0.2.0 2017-04-11
    BH 1.66.0-1 2018-02-13
    cli 1.0.0 2017-11-05
    colorspace 1.3-2 2016-12-14
    crayon 1.3.4 2017-09-16
    dichromat 2.0-0 2013-01-24
    digest 0.6.15 2018-01-28
    ggplot2 * 2.2.1.9000 2018-06-30
    glue 1.2.0 2017-10-29
    graphics * 3.5.1 2018-07-02
    grDevices * 3.5.1 2018-07-02
    grid 3.5.1 2018-07-02
    gridExtra 2.3 2017-09-09
    gtable 0.2.0 2016-02-26
    inline 0.3.14 2015-04-13
    labeling 0.3 2014-08-23
    lattice 0.20-35 2017-03-25
    lazyeval 0.2.1 2017-10-29
    magrittr 1.5 2014-11-22
    MASS 7.3-50 2018-04-30
    Matrix 1.2-14 2018-04-13
    methods * 3.5.1 2018-07-02
    mgcv 1.8-24 2018-06-23
    munsell 0.4.3 2016-02-13
    nlme 3.1-137 2018-04-07
    pillar 1.2.3 2018-05-25
    plyr 1.8.4 2016-06-08
    R6 2.2.2 2017-06-17
    RColorBrewer 1.1-2 2014-12-07
    Rcpp 0.12.17 2018-05-18
    RcppEigen 0.3.3.4.0 2018-02-07
    reshape2 1.4.3 2017-12-11
    rlang 0.2.1 2018-05-30
    rstan * 2.17.3 2018-01-20
    scales 0.5.0 2017-08-24
    StanHeaders * 2.17.2 2018-01-20
    stats * 3.5.1 2018-07-02
    stats4 3.5.1 2018-07-02
    stringi 1.2.3 2018-06-12
    stringr * 1.3.1 2018-05-10
    tibble * 1.4.2 2018-01-22
    tools 3.5.1 2018-07-02
    utf8 1.1.4 2018-05-24
    utils * 3.5.1 2018-07-02
    viridisLite 0.3.0 2018-02-01
    withr 2.1.2 2018-03-15
    source
    CRAN (R 3.5.0)
    CRAN (R 3.5.0)
    CRAN (R 3.5.0)
    CRAN (R 3.5.0)
    CRAN (R 3.5.0)
    CRAN (R 3.5.0)
    CRAN (R 3.5.0)
    Github (tidyverse/ggplot2@348b26f)
    CRAN (R 3.5.0)
    local
    local
    local
    CRAN (R 3.5.0)
    CRAN (R 3.5.0)
    CRAN (R 3.5.0)
    CRAN (R 3.5.0)
    CRAN (R 3.5.1)
    CRAN (R 3.5.0)
    CRAN (R 3.5.0)
    CRAN (R 3.5.1)
    CRAN (R 3.5.1)
    local
    CRAN (R 3.5.1)
    CRAN (R 3.5.0)
    CRAN (R 3.5.1)
    cran (@1.2.3)
    CRAN (R 3.5.0)
    CRAN (R 3.5.0)
    CRAN (R 3.5.0)
    cran (@0.12.17)
    CRAN (R 3.5.0)
    CRAN (R 3.5.0)
    cran (@0.2.1)
    CRAN (R 3.5.0)
    CRAN (R 3.5.0)
    CRAN (R 3.5.0)
    local
    local
    cran (@1.2.3)
    cran (@1.3.1)
    CRAN (R 3.5.0)
    local
    cran (@1.1.4)
    local
    CRAN (R 3.5.0)
    CRAN (R 3.5.0)


#2

I was able to debug this. In my case it turned out to be a dimension mismatch problem


#3

Out of curiosity, was there any difference in error messages if chains = 1 or chains = 4?


#4

No, the chain number did not make a difference.


#5

Ugg, thanks for checking. @bgoodri don’t dimension mismatches usually throw useful errors? Is this a known issue?