Rename the SpatRaster so it has the same name as the predictor variable in your model.
names(bathy_pei) <- 'bathy_pei' rf_pred = terra::predict(bathy_pei, model=rf_a, na.rm = FALSE)