diff --git a/apps/stasher/python/src/stasher.py b/apps/stasher/python/src/stasher.py
index 0bf8c7a6ea9558f6eb71d165726bf8ec1b0c990b..99aada0d509ab30c37852294e20017d874d6aef3 100644
--- a/apps/stasher/python/src/stasher.py
+++ b/apps/stasher/python/src/stasher.py
@@ -4110,6 +4110,8 @@ def main():
             err("getref: bad argument count")
             usage()
 
+        res = client.getref()
+
         if argc == 1:
             # try to open output file
             path = args[0]
@@ -4121,7 +4123,6 @@ def main():
         else:
             outfile = sys.stdout
 
-        res = client.getref()
         if res == None:
             err("Failed to retrieve node ref")
             sys.exit(1)