# Potential bug in Maaslin3

**URL:** <https://forum.biobakery.org/t/potential-bug-in-maaslin3/8832>\
**Category:** Downstream analysis and statistics\
**Created:** [March 18, 2026, 4:25pm UTC](https://forum.biobakery.org/t/potential-bug-in-maaslin3/8832 "2026-03-18T16:25:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![JJ\_Colgan](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/jj_colgan/32/3597_2.png) [@JJ\_Colgan](https://forum.biobakery.org/u/JJ_Colgan)\
**Post date:** [March 18, 2026, 4:25pm UTC](https://forum.biobakery.org/t/potential-bug-in-maaslin3/8832/1 "2026-03-18T16:25:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![WillNickols](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/willnickols/32/3223_2.png) [@WillNickols](https://forum.biobakery.org/u/WillNickols)\
**Post date:** [March 18, 2026, 4:39pm UTC](https://forum.biobakery.org/t/potential-bug-in-maaslin3/8832/2 "2026-03-18T16:39:51Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![JJ\_Colgan](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/jj_colgan/32/3597_2.png) [@JJ\_Colgan](https://forum.biobakery.org/u/JJ_Colgan)\
**Post date:** [March 18, 2026, 4:58pm UTC](https://forum.biobakery.org/t/potential-bug-in-maaslin3/8832/3 "2026-03-18T16:58:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![WillNickols](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/willnickols/32/3223_2.png) [@WillNickols](https://forum.biobakery.org/u/WillNickols)\
**Post date:** [March 20, 2026, 7:24pm UTC](https://forum.biobakery.org/t/potential-bug-in-maaslin3/8832/4 "2026-03-20T19:24:16Z")

</div>

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.
