Hi @Jones, Darren ,
The object specified does not belong to a list means that SharePoint attempt to get an Item(Specified by strUrl) that does not belong to the SPWeb.
If you did not set some url correctly, this error may occur. Please check this link for more information.
https://stackoverflow.com/questions/39413728/the-object-specified-does-not-belong-to-a-list-error-using-csom
In your case, I guess the $CurrentDocSet or $spoDocumentSet didn't get the correct value. You can try to check the value of them or provide us with text documentation of the code so that we can test about the issue.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.