For the record, the offending command is

plot3d([r,theta,sqrt(sin(theta))],[r,0,1],[theta,0,2*%pi], [gnuplot_pm3d,true], [gnuplot_preamble, "set pm3d map"], [grid,1,1], [transform_xy,make_transform([r,theta,z],r*cos(theta),r*sin(theta),z)])

And, as expected, the problem is from sqrt(sin(theta)) when theta = 2*%pi.

It's easy enough to make plot3d honor the plot_realpart option, but plot_realpart defaults to false, so we still get the problem where NIL is encountered. I don't know what the right thing would be here.