Describe the bug
cmdstanr 0.9.0.9000 deprecated metadata$model_params (now NULL). brms' read_csv_as_stanfit() depends on this field to compute parameter dimensions for the internal stanfit object. With model_params = NULL, brms silently drops population-level coefficients — verified to lose 1–3 parameters in models with 3–8 predictors. No warnings or errors are raised.
CmdStan and cmdstanr are working correctly — all draws are present in the CSV output and in cmdstanr's draws objects. The issue is that the deprecation removed a field that brms relies on, without a compatibility shim or deprecation warning to downstream packages.
Per the NEWS.md entry for 0.9.0.9000, the deprecated field is:
model_params element of fit$metadata() list (variables element)
The replacement fields metadata$stan_variables and metadata$stan_variable_sizes are present and correct, but brms does not yet use them for dimension computation.
To Reproduce
library(brms)
set.seed(42)
n <- 200
dat <- data.frame(
y = rnorm(n),
x1 = rnorm(n), x2 = rnorm(n), x3 = rnorm(n)
)
fit <- brm(y ~ x1 + x2 + x3,
data = dat, family = gaussian(),
chains = 1, iter = 500,
backend = "cmdstanr")
nrow(fixef(fit))
# Returns 3, expected 4 (Intercept is missing)
The mechanism: brms greps csfit$metadata$model_params to determine vector dimensions. When NULL, grepl(pattern, NULL) returns logical(0), dimensions are never assigned, and rename_pars() silently drops parameters.
Expected behavior
fixef(fit) should return 4 rows (Intercept + x1 + x2 + x3), matching the backend = "rstan" result. Either:
model_params should remain populated alongside the new fields during the deprecation period, or
- brms should be notified of the breaking change so it can migrate to
stan_variable_sizes
Operating system
macOS (Apple Silicon, Darwin 25.3.0)
CmdStanR version number
cmdstanr 0.9.0.9000 (dev, SHA a8adbb1), CmdStan 2.38.0
Additional context
Describe the bug
cmdstanr 0.9.0.9000 deprecated
metadata$model_params(nowNULL). brms'read_csv_as_stanfit()depends on this field to compute parameter dimensions for the internal stanfit object. Withmodel_params = NULL, brms silently drops population-level coefficients — verified to lose 1–3 parameters in models with 3–8 predictors. No warnings or errors are raised.CmdStan and cmdstanr are working correctly — all draws are present in the CSV output and in cmdstanr's draws objects. The issue is that the deprecation removed a field that brms relies on, without a compatibility shim or deprecation warning to downstream packages.
Per the NEWS.md entry for 0.9.0.9000, the deprecated field is:
The replacement fields
metadata$stan_variablesandmetadata$stan_variable_sizesare present and correct, but brms does not yet use them for dimension computation.To Reproduce
The mechanism: brms greps
csfit$metadata$model_paramsto determine vector dimensions. WhenNULL,grepl(pattern, NULL)returnslogical(0), dimensions are never assigned, andrename_pars()silently drops parameters.Expected behavior
fixef(fit)should return 4 rows (Intercept + x1 + x2 + x3), matching thebackend = "rstan"result. Either:model_paramsshould remain populated alongside the new fields during the deprecation period, orstan_variable_sizesOperating system
macOS (Apple Silicon, Darwin 25.3.0)
CmdStanR version number
cmdstanr 0.9.0.9000 (dev, SHA a8adbb1), CmdStan 2.38.0
Additional context
rename_pars()silently drops population-level coefficients with cmdstanr 0.9.0.9000 whenmetadata$model_paramsis NULL paul-buerkner/brms#1864dims_oi) but no visible parameter loss