set target to Minmus.
This code snippet used to work before on a previous version, but is currently not working in the latest version as of this post (1.1.7). I have been able to replicate this issue with ONLY kOS installed and the same error occurs on KSP version 1.6.1 and 1.7.
The error is as follows and the same thing happens when trying to set the target to any BODY (except of course the body the ship is orbiting since you can't set that target to begin with)

NOTE: you can still set the target to a VESSEL, at least all the vessels I tried to set.
It looks like it is assuming that the target its trying to set is always a vessel.