diff --git a/src/stan/services/pathfinder/single.hpp b/src/stan/services/pathfinder/single.hpp index 42f76d8f56..8ea520a7ee 100644 --- a/src/stan/services/pathfinder/single.hpp +++ b/src/stan/services/pathfinder/single.hpp @@ -822,10 +822,14 @@ inline auto pathfinder_lbfgs_single( lbfgs_ss.str(""); } if (ReturnLpSamples) { + // we want to terminate multi-path pathfinder during these unrecoverable + // exceptions throw; } else { logger.error(e.what()); - return error_codes::SOFTWARE; + return internal::ret_pathfinder( + error_codes::SOFTWARE, Eigen::Array(0), + Eigen::Matrix(0, 0), 0); } } }