Potential bug in Maaslin3

Hi,

I am running maaslin3 and want to run my model with small_random_effects = T, however whenever I run the model with this parameter set, i get the following error ```Error in vapply(random_terms, function(x) deparse(x[[3]]), FUN.VALUE = character(length(random_terms))) :
values must be length 2,
but FUN(X[[1]]) result is length 1```

Here is the command I am running: maaslin3(input_data = speciesLevelFecal,
input_metadata = fecalMeta,
formula = ‘~treatment*dayNumeric+depth+(1|mouse)+(1|cage)’,
output = ‘fecalResults’,
normalization = ‘none’,
transform = ‘LOG’,
augment = TRUE,
standardize = TRUE,
max_significance = 0.1,
median_comparison_abundance = TRUE,
median_comparison_prevalence = FALSE,
max_pngs = 250,
small_random_effects = T,
cores = 4)

and here is what i currently have loaded:

sessionInfo()
R version 4.5.1 (2025-06-13)
Platform: aarch64-apple-darwin20
Running under: macOS Sonoma 14.4.1

Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.12.1

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: America/Chicago
tzcode source: internal

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] maaslin3_1.0.2 lubridate_1.9.5 forcats_1.0.1 stringr_1.6.0 dplyr_1.2.0 purrr_1.2.1
[7] readr_2.2.0 tidyr_1.3.2 tibble_3.3.1 ggplot2_4.0.2 tidyverse_2.0.0

loaded via a namespace (and not attached):
[1] tidyselect_1.2.1 farver_2.1.2 Biostrings_2.76.0
[4] S7_0.2.1 SingleCellExperiment_1.30.1 lazyeval_0.2.2
[7] digest_0.6.39 timechange_0.4.0 lifecycle_1.0.5
[10] survival_3.8-6 tidytree_0.4.7 magrittr_2.0.4
[13] compiler_4.5.1 rlang_1.1.7 tools_4.5.1
[16] S4Arrays_1.8.1 bit_4.6.0 DelayedArray_0.34.1
[19] plyr_1.8.9 RColorBrewer_1.1-3 TreeSummarizedExperiment_2.16.1
[22] abind_1.4-8 BiocParallel_1.42.2 numDeriv_2016.8-1.1
[25] withr_3.0.2 BiocGenerics_0.54.1 grid_4.5.1
[28] stats4_4.5.1 scales_1.4.0 MASS_7.3-65
[31] logging_0.10-108 SummarizedExperiment_1.38.1 optparse_1.7.5
[34] cli_3.6.5 crayon_1.5.3 reformulas_0.4.4
[37] treeio_1.32.0 generics_0.1.4 rstudioapi_0.18.0
[40] httr_1.4.8 tzdb_0.5.0 getopt_1.20.4
[43] pbapply_1.7-4 minqa_1.2.8 ape_5.8-1
[46] splines_4.5.1 parallel_4.5.1 XVector_0.48.0
[49] matrixStats_1.5.0 vctrs_0.7.1 yulab.utils_0.2.4
[52] boot_1.3-32 Matrix_1.7-4 jsonlite_2.0.0
[55] IRanges_2.42.0 hms_1.1.4 S4Vectors_0.46.0
[58] bit64_4.6.0-1 glue_1.8.0 nloptr_2.2.1
[61] codetools_0.2-20 stringi_1.8.7 gtable_0.3.6
[64] GenomeInfoDb_1.44.3 GenomicRanges_1.60.0 UCSC.utils_1.4.0
[67] lmerTest_3.2-1 lme4_2.0-1 pillar_1.11.1
[70] rappdirs_0.3.4 GenomeInfoDbData_1.2.14 R6_2.6.1
[73] Rdpack_2.6.6 vroom_1.7.0 lattice_0.22-9
[76] Biobase_2.68.0 rbibutils_2.4.1 Rcpp_1.1.1
[79] SparseArray_1.8.1 nlme_3.1-168 MatrixGenerics_1.20.0
[82] fs_1.6.7 pkgconfig_2.0.3

Hi,

Are your mouse and cage variables coded as numbers or characters/factors? They’ll need to be coded as factors/characters to work properly. (Additionally, unless some mice moved cages, you probably don’t need both of those in the formula, just the mouse variable since cage is redundant with it.)

If that doesn’t solve it, do you still get the error if you simplify the formula? If so, can you send me the full log either here or at willnickols@g.harvard.edu?

Will

If I set both to factors, I stil get the error, if I simplify the formula and only use mouse it goes away.

If it’s true that each mouse was only in one cage, I’d just use mouse as the random effect then. Using both mouse and cage gives multicollinearity between the two variables (since knowing the mouse perfectly determines the cage), which is probably what’s causing the issue.