danbooru/danbooru · error · PostReplacementProcessor::Error

#{source_url} has multiple images. Enter the URL of a single

Error message

#{source_url} has multiple images. Enter the URL of a single image

What it means

Error "#{source_url} has multiple images. Enter the URL of a single image" thrown in danbooru/danbooru.

Source

Thrown at app/logical/post_replacement_processor.rb:79

  def rescale_notes(post)
    x_scale = post.image_width.to_f  / post.image_width_was.to_f
    y_scale = post.image_height.to_f / post.image_height_was.to_f

    post.notes.each do |note|
      note.rescale!(x_scale, y_scale)
    end
  end

  def get_file_for_upload(source_url, referer_url, file)
    return MediaFile.open(file) if file.present?
    raise Error, "No file or source URL provided" if source_url.blank?

    extractor = Source::Extractor.find(source_url, referer_url)
    raise Error, "No login credentials configured for #{extractor.site_name}." unless extractor.class.enabled?

    image_urls = extractor.image_urls
    raise Error, "#{source_url} has multiple images. Enter the URL of a single image" if image_urls.size > 1
    raise Error, "#{source_url} has no images" if image_urls.size == 0

    image_url = image_urls.first
    file = extractor.download_file!(image_url)

    [file, image_url]
  end
end

View on GitHub (pinned to 91fec09564)

Solutions

  1. Enter the direct URL of a single image instead of a page or gallery containing multiple images.

When it happens

Trigger: Thrown at app/logical/post_replacement_processor.rb:79 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of danbooru/danbooru@91fec09564 (2026-08-24). Data as JSON: /api/errors/b41fb54d7fa81d4a. Report an issue: GitHub.