The following code is valid in LaTeX language, but KaTeX interprets [b] to be size specification for \\ and throws error:
\begin{gathered}
a \\ [b]
\end{gathered}
The same holds even if one add whitespaces (including newline).
For now, one can avoid this bug by replace \\ by \\{} or [b] by {[b]}.