Had this exact error as well. Each deployment type was using a registry and a directory detection clause. I was reusing the same directory detection clause object and creating new registry clauses for each. Reusing the directory clause object was causing the issue. As soon as i removed\created a second directory clause object it worked perfectly.