IRCv3 Tag Logic?

I’d say you just get partial messages. Use a buffer to store data received from Twitch before processing.

Example from my bot (NodeJS):

this.sock.on('data', function(data) {
  this.buf += data.toString();
  if (this.buf.indexOf(this.lineTerminator) >= 0) {
    var lines = this.buf.split(this.lineTerminator);

    for (var i = 0; i < lines.length - 1; i++) {
      this.worker(lines[i]);
    }

    // put back any partial lines into the buffer
    this.buf = lines[lines.length - 1];
  }
}

(lineTerminator is “\r\n”.)