diff --git a/config/initializers/vips.rb b/config/initializers/vips.rb
index 25a17b2a17..8d5d5cdc91 100644
--- a/config/initializers/vips.rb
+++ b/config/initializers/vips.rb
@@ -25,3 +25,11 @@ if Rails.configuration.x.use_vips
 
   Vips.block_untrusted(true)
 end
+
+# In some places of the code, we rescue this exception, but we don't always
+# load libvips, so it may be an undefined constant:
+unless defined?(Vips)
+  module Vips
+    class Error < StandardError; end
+  end
+end