The actual problem might rather be that the syntax help is ignoring trailling spaces (see MC-165061). Removing trailing spaces when running a command might not be the wanted behavior, see also MC-65034.
Example in a command block: "setblock ~ ~1 ~ stone "
relates to
MC-165061Command blocks ignore trailing spaces when checking syntax
Resolved
MC-65034Chat and commands run via chat trim excess whitespace