diff --git a/commands/authenticate.go b/commands/authenticate.go
index <HASH>..<HASH> 100644
--- a/commands/authenticate.go
+++ b/commands/authenticate.go
@@ -100,9 +100,11 @@ func (cmd *Authenticate) Handle(mechanisms map[string]sasl.Server, conn Authenti
 			return err
 		}
 
-		scanner.Scan()
-		if err := scanner.Err(); err != nil {
-			return err
+		if !scanner.Scan() {
+			if err := scanner.Err(); err != nil {
+				return err
+			}
+			return errors.New("unexpected EOF")
 		}
 
 		encoded = scanner.Text()
commands: Properly handle EOF in Authenticate.Handle

scanner.Scan returns false but scanner.Err returns nil in case of EOF.