diff --git a/mercurial/obsolete.py b/mercurial/obsolete.py
index f90337706ce7954496d50e8d3ac5795ef20c5593_bWVyY3VyaWFsL29ic29sZXRlLnB5..ef50a62eec40802af664bcb404965649d16962e9_bWVyY3VyaWFsL29ic29sZXRlLnB5 100644
--- a/mercurial/obsolete.py
+++ b/mercurial/obsolete.py
@@ -575,7 +575,13 @@
         return len(self._all)
 
     def __nonzero__(self):
+        from . import statichttprepo
+
+        if isinstance(self.repo, statichttprepo.statichttprepository):
+            # If repo is accessed via static HTTP, then we can't use os.stat()
+            # to just peek at the file size.
+            return len(self._data) > 1
         if not self._cached('_all'):
             try:
                 return self.svfs.stat(b'obsstore').st_size > 1
             except OSError as inst:
@@ -578,8 +584,8 @@
         if not self._cached('_all'):
             try:
                 return self.svfs.stat(b'obsstore').st_size > 1
             except OSError as inst:
-                if inst.errno not in (errno.ENOENT, errno.EINVAL):
+                if inst.errno != errno.ENOENT:
                     raise
                 # just build an empty _all list if no obsstore exists, which
                 # avoids further stat() syscalls