diff --git a/mercurial/sshpeer.py b/mercurial/sshpeer.py
index e7bbeaa4f0a72d7f656b87864d0826bcd85fea26_bWVyY3VyaWFsL3NzaHBlZXIucHk=..a2f1d97e5284b60b3a16cb071ccc015f6721bc29_bWVyY3VyaWFsL3NzaHBlZXIucHk= 100644
--- a/mercurial/sshpeer.py
+++ b/mercurial/sshpeer.py
@@ -640,7 +640,7 @@
     """
     u = urlutil.url(path.loc, parsequery=False, parsefragment=False)
     if u.scheme != b'ssh' or not u.host or u.path is None:
-        raise error.RepoError(_(b"couldn't parse location %s") % path)
+        raise error.RepoError(_(b"couldn't parse location %s") % path.loc)
 
     urlutil.checksafessh(path.loc)