The bug
If you enter something like /gamemode survival
(notice the double space, for the bugtracker one was replaced with  
), the preview predicts an error, but the command works.
The exact error message can vary, sometimes it wants the next, sometimes the second next part. For example:
/gamemode survival
: No error message, just four lines with grey/gamemode
and red gamemode names/effect give @p strength 100 100
: "Invalid name or uuid at position 12: …fect give <--[HERE]" (So it apparently expects the next argument now, the selector.)/effect give @p strength 100 100
: "Expected integer at position 16: … give @p <--[HERE]" (So it apparently expects the second next argument now, the duration. But if I entered the duration there, the command would fail when executing.)
Linked issues
Comments 2
Resolved as duplicate of MC-65034 since that appears to be the underlying issue, for example /gamemode survival
(two spaces) becomes /gamemode survival
(one space) for the server and is therefore a valid command.
This seems to be caused by the chat space normalization happening when executing the command, but not for the live preview. In a similar vein, NBSP or ohgam spaces also break the preview but work fine for actual execution (e.g.
/gamemode creative
and/gamemode creative
).