Phylogenetic models with unseen categories

I am fitting a phylogenetic model following the instructions here: https://cran.r-project.org/web/packages/brms/vignettes/brms_phylogenetics.html. Something like this:

b.1 <- brm(Y ~ X +  (1 | phylo)
    , data = df
    , family = poisson
    , cov_ranef = list(phylo = phylo))

Now, I am splitting the data into a training and testing data sets, but when I am trying to make the predictions for the testing dataset brm complains that there are new levels in the random effects. However, the phylo object contains those new levels, and they are in the training dataset as factors. Maybe I am misunderstanding something, but why can’t the model make use of this information?

@avehtari is offline atm but I think he can answer why splitting phylogenetic data can be problematic. Maybe @paul.buerkner has some thoughts as well.

You need to set allow_new_levels = TRUE in the predictions but note that brms does not take the phylogenetic structure into account, yet, when simulating new levels. I believe there is also a brms github issue somewhere discussing this.