Error from MusicTrackSetDestMIDIEndpoint()

I'm getting error -10852 (kAudioToolboxErr_InvalidPlayerState) from MusicTrackSetDestMIDIEndpoint, but it's really not clear what the error actually means. Does anyone happen to know the conditions that will lead to that error? There are two possibilities I'm wondering about in particular: 1) if the sequence is playing when I try to set it, and 2) if sending the same endpoint ref as it already had will trigger it.

Any help greatly appreciated.