carrierwaveuploader/carrierwave · error · CarrierWave::ProcessingError
errors.messages.processing_error
Error message
errors.messages.processing_error
What it means
Raised as CarrierWave::ProcessingError by the ruby-vips pipeline in CarrierWave::Vips (around line 298) when builder.call or the subsequent move/format change raises ::Vips::Error. libvips errors are terse and low-level ('not a known file format', 'unsupported image type', loader errors), and all of them collapse into this generic processing error.
Source
Thrown at lib/carrierwave/processing/vips.rb:298
#
# [CarrierWave::ProcessingError] if processing failed.
def vips!
builder = ImageProcessing::Vips.source(current_path)
builder = yield(builder)
result = builder.call
result.close
FileUtils.mv result.path, current_path
if File.extname(result.path) != File.extname(current_path)
move_to = current_path.chomp(File.extname(current_path)) + File.extname(result.path)
file.content_type = Marcel::Magic.by_path(move_to).try(:type)
file.move_to(move_to, permissions, directory_permissions)
end
rescue ::Vips::Error
message = I18n.translate(:"errors.messages.processing_error")
raise CarrierWave::ProcessingError, message
end
private
def resolve_dimensions(*dimensions)
dimensions.map do |value|
next value unless value.instance_of?(Proc)
value.arity >= 1 ? value.call(self) : value.call
end
end
def vips_image
::Vips::Image.new_from_buffer(read, "")
end
end # Vips
end # CarrierWave
View on GitHub (pinned to b5f0abe10e)
Solutions
- Verify libvips can decode the formats you accept on the server (vips --list classes / vipsheader -a test.heic) and install missing loader packages (libheif, librsvg, etc.)
- Sniff the content type with Marcel before processing and reject non-images early
- Rescue CarrierWave::ProcessingError in the upload flow and return a friendly validation error
- If a specific format is required, keep that format's delegate available or restrict the uploader's extension allowlist to what vips supports
Example fix
# before
class ImageUploader < CarrierWave::Uploader::Base
include CarrierWave::Vips
process resize_to_limit: [1200, 1200] # heic on loader-less libvips -> ProcessingError
end
# after
class ImageUploader < CarrierWave::Uploader::Base
include CarrierWave::Vips
process resize_to_limit: [1200, 1200]
def extension_allowlist
%w(jpg jpeg png webp) # only formats the deployed libvips can load
end
end Defensive patterns
Strategy: try-catch
Validate before calling
require 'vips' def vips_readable?(path) Vips::Image.new_from_file(path, access: :sequential) true rescue Vips::Error false end before_cache do |file| raise CarrierWave::ProcessingError, :unsupported_image unless vips_readable?(file.path) end
Try / catch
begin uploader.store! rescue CarrierWave::ProcessingError errors.add(:image, :processing_failed) end
Prevention
- Verify the production libvips build supports every accepted format (vips --list classes) — loaders like heif/svg are optional compile-time features
- Mirror the production libvips build in CI and run a real process spec
- Sniff content with Marcel and reject non-images before the vips pipeline runs
When it happens
Trigger: An uploader including CarrierWave::Vips processing (process resize_to_limit, version blocks, or format conversion) where libvips cannot load the input — corrupt bytes, a non-image, or a format whose loader is not compiled into the installed libvips (e.g. heif, svg, some TIFF variants).
Common situations: Deploying to Docker/Alpine images where libvips lacks optional loaders; users uploading HEIC from phones on a server without libheif; switching an uploader from mini_magick to vips without re-checking format support; truncated uploads.
Related errors
- errors.messages.processing_error
- errors.messages.processing_error
- errors.messages.content_type_allowlist_error
- errors.messages.content_type_denylist_error
- errors.messages.min_width_error
AI-assisted analysis of carrierwaveuploader/carrierwave@b5f0abe10e (2026-08-21).
Data as JSON: /api/errors/e337f16bc1dd64ee.
Report an issue: GitHub.