CKError 12 - "Invalid Arguments" - "No operations present in request"

These forums have helped me a bunch already, but I can't seem to find anything for a CloudKit error I have been experiencing. I have made a database that is full of golf course information. There are a lot of datapoints, so I am using a query with a cursor. 80-90% of the time it works without issue. However, the other 10% of the time I get a CloudKit Error 12 "Invalid Arguments - No Operations Present in Request". Because the fail is so intermittent I cannot tell if this is a network issue or an issue with my code. Sometimes it will go 30 requests without the error and then 5-6 in a row erroring.


Is this a code issue? Do I need better error handling?


Calling the function after defining:

            let pred = NSPredicate(format: "region == %@", "\(regionMod)")
            let sort = NSSortDescriptor(key: "course", ascending: true)
            let query = CKQuery(recordType: "Courses", predicate: pred)
            query.sortDescriptors = [sort]
           
            let operationQueue = NSOperationQueue()
            let queryOperation = CKQueryOperation(query: query)
           
            cursorQuery(queryOperation, onOperationQueue: operationQueue, region: region)


Here is the cursor query.

func cursorQuery(queryOperation: CKQueryOperation, onOperationQueue operationQueue: NSOperationQueue, region: String) {
  
     let container = CKContainer.defaultContainer()
     let publicDatabase = container.publicCloudDatabase

     queryOperation.database = publicDatabase
      
     queryOperation.recordFetchedBlock = { (record) -> Void in
          self.courseRecords.append(record)
     }

     queryOperation.queryCompletionBlock = { (cursor: CKQueryCursor?, error: NSError?) -> Void in
       dispatch_async(dispatch_get_main_queue()) {
           guard error==nil else {
               self.fetchingAlert.dismissViewControllerAnimated(true, completion: nil)
               print("There was an error fetching \(region)")
               let ac = UIAlertController(title: "Error", message: "There was an error accessing the cloud. \(error!.code) \(error!.description), local: \(error!.localizedDescription)", preferredStyle: .Alert)
               ac.addAction(UIAlertAction(title: "OK", style: .Default, handler: nil))
               self.presentViewController(ac, animated: true, completion: nil)             
               return
           }
           if let queryCursor = cursor {
               print("Found cursor")
               self.fetchingAlert.title = "Fetching \(region): \(self.lineNum)"
               self.lineNum += 1
               let queryCursorOperation = CKQueryOperation(cursor: queryCursor)
               self.cursorQuery(queryCursorOperation, onOperationQueue: operationQueue, region: region)
           }
           else {
               print("Cursor completed with \(self.courseRecords.count) courses.")
                   self.fetchingAlert.dismissViewControllerAnimated(true, completion: nil)
                   let defaults = NSUserDefaults.standardUserDefaults()
                   defaults.setObject(self.myRegions, forKey: "myRegions")             
          }
       }
   }  
operationQueue.addOperation(queryOperation)
}
CKError 12 - "Invalid Arguments" - "No operations present in request"
 
 
Q