I found some time to take a look at your code. It seems that the logcdf of the Beta distribution uses some scan operations to perform the computations. These seem to fail when either alpha or beta are RVs… I did not manage to find a workaround to the problem, sorry. Maybe @junpenglao can help with this.