diff --git a/lib/WriteRepo.hs b/lib/WriteRepo.hs
index c0bf31b61b48beef2e4013644877fbf243be34d8..1ed3a84b522626317e124f60a3959debbe35d4cf 100644
--- a/lib/WriteRepo.hs
+++ b/lib/WriteRepo.hs
@@ -16,15 +16,18 @@ import           Data.Set               (Set)
 import qualified Data.Set               as S
 import           Paths                  (normalise)
 import           System.Directory.Extra (copyFile, createDirectoryIfMissing)
+import           System.Exit            (ExitCode (..))
 import           System.FilePath        (takeDirectory)
 import qualified System.FilePath        as FP
 import           System.FilePath.Posix  ((</>))
 import           Types                  (Dep (Local))
 
 
-writeAdjustedRepository :: FilePath -> FilePath -> DirResult -> IO ()
+writeAdjustedRepository :: FilePath -> FilePath -> DirResult -> IO ExitCode
 writeAdjustedRepository inPath outPath result
-  | resultIsFatal result = pure ()
+  | resultIsFatal result = do
+      putStrLn "FATAL: Repository has missing assets; cannot write to outPath"
+      pure (ExitFailure 1)
   | otherwise = do
       createDirectoryIfMissing True outPath
 
@@ -41,7 +44,7 @@ writeAdjustedRepository inPath outPath result
                    let mapdir = takeDirectory mappath in
                    mapMaybe (\case
                      Local path -> Just . normalise mapdir $ path
-                     _ -> Nothing)
+                     _          -> Nothing)
                    $ mapresultDepends mapresult)
             . toList $ dirresultMaps result
 
@@ -53,3 +56,5 @@ writeAdjustedRepository inPath outPath result
         in do
           putStrLn $ "copying " <> assetPath <> " → " <> newPath
           copyFile assetPath newPath
+
+      pure ExitSuccess
diff --git a/src/Main.hs b/src/Main.hs
index 1862c5b5d1eb2474a1ca57ed6a89331c7592b26f..9fefd82e34babb73bb77858552b15639a15b05ca 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -17,6 +17,7 @@ import           CheckDir                 (recursiveCheckDir)
 import WriteRepo (writeAdjustedRepository)
 import           Types                    (Level (..))
 import           Util                     (printPretty)
+import System.Exit (exitWith)
 
 -- | the options this cli tool can take
 data Options = Options
@@ -47,15 +48,16 @@ run options = do
 
   lints <- recursiveCheckDir repo entry
 
-  case out options of
-    Just outpath -> writeAdjustedRepository repo outpath lints
-    Nothing   -> pure ()
-
   if json options
     then printLB
     $ if pretty options then encodePretty lints else encode lints
     else printPretty (level, lints)
 
+  case out options of
+    Just outpath -> writeAdjustedRepository repo outpath lints
+                    >>= exitWith
+    Nothing -> pure ()
+
 -- | haskell's many string types are FUN …
 printLB :: LB.ByteString -> IO ()
 printLB a = putStrLn $ C8.unpack $ LB.toStrict a