The state of the cursor (such as OPENed, CLOSEd) is not valid for the current operation.
Make sure you've executed the necessary steps before calling this function.