diff --git a/lib/spack/spack/stage.py b/lib/spack/spack/stage.py
index 54d5eb7e6a8a8ef8cc71298a3a00a22277fccd51..9145fa537132d474e81e1ef87f77ef84617257c9 100644
--- a/lib/spack/spack/stage.py
+++ b/lib/spack/spack/stage.py
@@ -155,11 +155,17 @@ def fetch(self):
         else:
             tty.msg("Fetching %s" % self.url)
 
-            # Run curl but grab the mime type from the http headers
-            headers = spack.curl('-#',        # status bar
-                                 '-O',        # save file to disk
-                                 '-D', '-',   # print out HTML headers
-                                 '-L', self.url, return_output=True)
+            try:
+                # Run curl but grab the mime type from the http headers
+                headers = spack.curl('-#',        # status bar
+                                     '-O',        # save file to disk
+                                     '-D', '-',   # print out HTML headers
+                                     '-L', self.url, return_output=True)
+            except:
+                # clean up archive on failure.
+                if self.archive_file:
+                    os.remove(self.archive_file)
+                raise
 
             # Check if we somehow got an HTML file rather than the archive we
             # asked for.  We only look at the last content type, to handle