diff --git a/lib/protoparser/common/lines_reader.go b/lib/protoparser/common/lines_reader.go
index 1549a20795..a1fe0d3c6a 100644
--- a/lib/protoparser/common/lines_reader.go
+++ b/lib/protoparser/common/lines_reader.go
@@ -93,7 +93,7 @@ again:
 }
 
 func isEOFLikeError(err error) bool {
-	if errors.Is(err, io.EOF) {
+	if errors.Is(err, io.EOF) || errors.Is(err, io.ErrUnexpectedEOF) {
 		return true
 	}
 	s := err.Error()
diff --git a/lib/protoparser/common/lines_reader_test.go b/lib/protoparser/common/lines_reader_test.go
index a083322c1a..e37ac720c9 100644
--- a/lib/protoparser/common/lines_reader_test.go
+++ b/lib/protoparser/common/lines_reader_test.go
@@ -2,6 +2,7 @@ package common
 
 import (
 	"bytes"
+	"errors"
 	"fmt"
 	"io"
 	"reflect"
@@ -25,6 +26,20 @@ func TestReadLinesBlockFailure(t *testing.T) {
 		if _, _, err := ReadLinesBlock(fr, nil, nil); err == nil {
 			t.Fatalf("expecting non-nil error")
 		}
+
+		un := &unexpectedEOF{}
+		if _, _, err := ReadLinesBlock(un, nil, nil); err != nil {
+			if !errors.Is(err, io.EOF) {
+				t.Fatalf("get unexpected error, expecting io.EOF")
+			}
+		}
+
+		ef := eofErr{}
+		if _, _, err := ReadLinesBlock(ef, nil, nil); err != nil {
+			if !errors.Is(err, io.EOF) {
+				t.Fatalf("get unexpected error, expecting io.EOF")
+			}
+		}
 	}
 
 	// empty string
@@ -41,6 +56,18 @@ func (fr *failureReader) Read(p []byte) (int, error) {
 	return 0, fmt.Errorf("some error")
 }
 
+type unexpectedEOF struct{}
+
+func (un unexpectedEOF) Read(p []byte) (int, error) {
+	return 0, io.ErrUnexpectedEOF
+}
+
+type eofErr struct{}
+
+func (eo eofErr) Read(p []byte) (int, error) {
+	return 0, io.EOF
+}
+
 func TestReadLinesBlockMultiLinesSingleByteReader(t *testing.T) {
 	f := func(s string, linesExpected []string) {
 		t.Helper()