diff --git a/src/stdlib_io_npy_load.fypp b/src/stdlib_io_npy_load.fypp
index 01fce87a9..05c82b1a5 100644
--- a/src/stdlib_io_npy_load.fypp
+++ b/src/stdlib_io_npy_load.fypp
@@ -122,7 +122,10 @@ contains
         character(len=8) :: header
         character :: buf(4)
         logical :: fortran_order
-
+        
+        ! stat should be zero if no error occurred
+        stat = 0
+        
         read(io, iostat=stat) header
         if (stat /= 0) return