diff --git a/src/managesieve/cmd-setactive.c b/src/managesieve/cmd-setactive.c
index cb025cd35147bca6e2fb93a3a8c6b798cbea4c9d..2d25e2edc955b0705e37200594fc9bf7667da5dd 100644
--- a/src/managesieve/cmd-setactive.c
+++ b/src/managesieve/cmd-setactive.c
@@ -99,7 +99,8 @@ cmd_setactive_activate(struct client_command_context *cmd,
 		}
 	} else if (errormsg == NULL) {
 		struct event_passthrough *e =
-			client_command_create_finish_event(cmd);
+			client_command_create_finish_event(cmd)->
+			add_str("error", "Compilation failed");
 		e_debug(e->event(), "Failed to activate script `%s': "
 			"Compilation failed (%u errors, %u warnings)",
 			scriptname, error_count, warning_count);
@@ -107,7 +108,8 @@ cmd_setactive_activate(struct client_command_context *cmd,
 		client_send_no(client, str_c(errors));
 	} else {
 		struct event_passthrough *e =
-			client_command_create_finish_event(cmd);
+			client_command_create_finish_event(cmd)->
+			add_str("error", errormsg);
 		e_debug(e->event(), "Failed to activate script `%s': %s",
 			scriptname, errormsg);