diff --git a/tests/execute/errors.svtest b/tests/execute/errors.svtest
index 713180535ccbcbee3f5521279cddb312ce121504..45bc39c449d74191928161a7407dc62550c394a0 100644
--- a/tests/execute/errors.svtest
+++ b/tests/execute/errors.svtest
@@ -133,3 +133,20 @@ test "Fileinto invalid folder name" {
 	}
 }
 
+test "Fileinto bad UTF-8 in folder name" {
+	if not test_script_compile "errors/fileinto-bad-utf8.sieve" {
+		test_fail "compile failed";
+	}
+
+	if test_script_run {
+		test_fail "execution should have failed";
+	}
+
+	if not test_error :count "eq" :comparator "i;ascii-numeric" "1" {
+		test_fail "wrong number of runtime errors reported";
+	}
+
+	if not test_error :index 1 :contains "invalid folder name" {
+		test_fail "unexpected error reported";
+	}
+}
diff --git a/tests/execute/errors/fileinto-bad-utf8.sieve b/tests/execute/errors/fileinto-bad-utf8.sieve
new file mode 100644
index 0000000000000000000000000000000000000000..3e57c92247e3667dcf604cb5883aaba141cdd614
--- /dev/null
+++ b/tests/execute/errors/fileinto-bad-utf8.sieve
@@ -0,0 +1,7 @@
+require "fileinto";
+require "variables";
+require "encoded-character";
+
+set "mailbox" "${hex:ff}rop";
+fileinto "${mailbox}";
+