I cannot find the cause of the error when I use this function. You can find a minimal example here.

Thanks in advance.

It also fails at the example in the documentation, so I think this is a bug.