mileszs/wicked_pdf · error

[wicked_pdf] #{response.code} #{response.message}: #{url}

Error message

[wicked_pdf] #{response.code} #{response.message}: #{url}

What it means

Error "[wicked_pdf] #{response.code} #{response.message}: #{url}" thrown in mileszs/wicked_pdf.

Source

Thrown at lib/wicked_pdf/wicked_pdf_helper/assets.rb:86

      def wicked_pdf_asset_base64(path)
        asset = find_asset(path)
        raise MissingLocalAsset, path if asset.nil?

        base64 = Base64.encode64(asset.to_s).gsub(/\s+/, '')
        "data:#{asset.content_type};base64,#{Rack::Utils.escape(base64)}"
      end

      # Using `image_tag` with URLs when generating PDFs (specifically large PDFs with lots of pages) can cause buffer/stack overflows.
      #
      def wicked_pdf_url_base64(url)
        response = Net::HTTP.get_response(URI(url))

        if response.is_a?(Net::HTTPSuccess)
          base64 = Base64.encode64(response.body).gsub(/\s+/, '')
          "data:#{response.content_type};base64,#{Rack::Utils.escape(base64)}"
        else
          Rails.logger.warn("[wicked_pdf] #{response.code} #{response.message}: #{url}")
          nil
        end
      end

      def wicked_pdf_stylesheet_link_tag(*sources)
        stylesheet_contents = sources.collect do |source|
          source = WickedPdfHelper.add_extension(source, 'css')
          "<style type='text/css'>#{read_asset(source)}</style>"
        end.join("\n")

        stylesheet_contents.gsub(ASSET_URL_REGEX) do
          if Regexp.last_match[1].starts_with?('data:')
            "url(#{Regexp.last_match[1]})"
          else
            "url(#{wicked_pdf_asset_path(Regexp.last_match[1])})"
          end
        end.html_safe
      end

View on GitHub (pinned to bce498de54)

When it happens

Trigger: Thrown at lib/wicked_pdf/wicked_pdf_helper/assets.rb:86 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of mileszs/wicked_pdf@bce498de54 (2026-08-23). Data as JSON: /api/errors/f077e14d2208ab47. Report an issue: GitHub.