I think you need to go through the code for the table again probably you might have closed one which wasn’t opened or maybe there is a character added before open a table code like a space character before opening the table that has Also cause errors like this (signature codes).
Another invalid BBcode might be that the bytes are more than the limit, so I think you need to cut them into two
Yeah, that's what it is. Posts over 65535 bytes get cut off at 65535 bytes. If that makes the BBcode invalid in certain ways, then you get the INVALID BBCODE error.
Also, note that a byte is different from a character. Because SMF stores "special" characters in a particularly space-inefficient way, each Russian character uses about 6 bytes, and each line break also uses 6 bytes.