{"record":{"id":"e337f16bc1dd64ee","repo":"carrierwaveuploader/carrierwave","slug":"errors-messages-processing-error-e337f1","errorCode":null,"errorMessage":"errors.messages.processing_error","messagePattern":"errors\\.messages\\.processing_error","errorType":"exception","errorClass":"CarrierWave::ProcessingError","httpStatus":null,"severity":"error","filePath":"lib/carrierwave/processing/vips.rb","lineNumber":298,"sourceCode":"    #\n    # [CarrierWave::ProcessingError] if processing failed.\n    def vips!\n      builder = ImageProcessing::Vips.source(current_path)\n      builder = yield(builder)\n\n      result = builder.call\n      result.close\n\n      FileUtils.mv result.path, current_path\n\n      if File.extname(result.path) != File.extname(current_path)\n        move_to = current_path.chomp(File.extname(current_path)) + File.extname(result.path)\n        file.content_type = Marcel::Magic.by_path(move_to).try(:type)\n        file.move_to(move_to, permissions, directory_permissions)\n      end\n    rescue ::Vips::Error\n      message = I18n.translate(:\"errors.messages.processing_error\")\n      raise CarrierWave::ProcessingError, message\n    end\n\n  private\n\n    def resolve_dimensions(*dimensions)\n      dimensions.map do |value|\n        next value unless value.instance_of?(Proc)\n        value.arity >= 1 ? value.call(self) : value.call\n      end\n    end\n\n    def vips_image\n      ::Vips::Image.new_from_buffer(read, \"\")\n    end\n\n  end # Vips\nend # CarrierWave\n","sourceCodeStart":280,"sourceCodeEnd":316,"githubUrl":"https://github.com/carrierwaveuploader/carrierwave/blob/b5f0abe10ecf6500309fc83e0e8969cf57ba690e/lib/carrierwave/processing/vips.rb#L280-L316","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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"],"exampleFix":"# before\nclass ImageUploader < CarrierWave::Uploader::Base\n  include CarrierWave::Vips\n  process resize_to_limit: [1200, 1200] # heic on loader-less libvips -> ProcessingError\nend\n\n# after\nclass ImageUploader < CarrierWave::Uploader::Base\n  include CarrierWave::Vips\n  process resize_to_limit: [1200, 1200]\n\n  def extension_allowlist\n    %w(jpg jpeg png webp) # only formats the deployed libvips can load\n  end\nend","handlingStrategy":"try-catch","validationCode":"require 'vips'\n\ndef vips_readable?(path)\n  Vips::Image.new_from_file(path, access: :sequential)\n  true\nrescue Vips::Error\n  false\nend\n\nbefore_cache do |file|\n  raise CarrierWave::ProcessingError, :unsupported_image unless vips_readable?(file.path)\nend","typeGuard":null,"tryCatchPattern":"begin\n  uploader.store!\nrescue CarrierWave::ProcessingError\n  errors.add(:image, :processing_failed)\nend","preventionTips":["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"],"tags":["carrierwave","vips","libvips","image-processing","upload"],"backgroundTag":"image-processing-failed","analyzedSha":"b5f0abe10ecf6500309fc83e0e8969cf57ba690e","analyzedAt":"2026-08-21T18:07:27.715Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}