When the user enters a console command, it's handled by mods on a parallel thread. That can cause errors, since the game isn't threadsafe. Queue commands and execute them in the next update tick instead.
Pathoschild commented
Done in develop for the upcoming SMAPI 2.6-beta.21.