diff --git a/common/errors/errors.go b/common/errors/errors.go
index b7941f1d..6dfb8a45 100644
--- a/common/errors/errors.go
+++ b/common/errors/errors.go
@@ -40,10 +40,8 @@ func (err *Error) pkgPath() string {
 		return ""
 	}
 	path := reflect.TypeOf(err.pathObj).PkgPath()
-	for i := 0; i < len(path); i++ {
-		if path[i] == '/' {
-			return path[trim:]
-		}
+	if len(path) >= trim {
+		return path[trim:]
 	}
 	return path
 }