Pointwise log-likelihood for loo/waic with custom "black-box" probability distribution

I don’t see anything obviously wrong with the code. Can you provide a fully executable snippet? Also what error message were you seeing exactly?