diff --git a/R/estimate_infections.R b/R/estimate_infections.R index 2a2c68020..b998aa370 100644 --- a/R/estimate_infections.R +++ b/R/estimate_infections.R @@ -450,7 +450,8 @@ fit_model_with_nuts <- function(args, future = FALSE, max_execution_time = Inf, ) } - if (inherits(fit, c("stanfit", "CmdStanMCMC"))) { + if ((inherits(fit, "stanfit") && fit@mode != 2L) || + inherits(fit, "CmdStanMCMC")) { return(fit) } else { return(NULL)