diff --git a/src/main/java/com/xebia/incubator/xebium/ScreenCapture.java b/src/main/java/com/xebia/incubator/xebium/ScreenCapture.java
index <HASH>..<HASH> 100644
--- a/src/main/java/com/xebia/incubator/xebium/ScreenCapture.java
+++ b/src/main/java/com/xebia/incubator/xebium/ScreenCapture.java
@@ -71,11 +71,12 @@ class ScreenCapture {
 		}
 	}
 
-	void setScreenshotPolicy(String policy) {
+	void setScreenshotPolicy(String policy) throws IOException {
 		if ("none".equals(policy) || "nothing".equals(policy)) {
 			screenshotPolicy = ScreenshotPolicy.NONE;
 		} else if ("failure".equals(policy) || "error".equals(policy)) {
-			screenshotPolicy =ScreenshotPolicy.FAILURE;
+			screenshotPolicy = ScreenshotPolicy.FAILURE;
+			initializeIndexIfNeeded();
 		} else if ("step".equals(policy) || "every step".equals(policy)) {
 			screenshotPolicy = ScreenshotPolicy.STEP;
 		} else if ("assertion".equals(policy) || "every assertion".equals(policy)) {
Initialize index file early when screenshots are triggered by errors