mileszs/wicked_pdf · error · WickedPdf::WickedPdfHelper::Assets::MissingLocalAsset

Could not find asset '#{path}'

Error message

Could not find asset '#{path}'

What it means

Error "Could not find asset '#{path}'" thrown in mileszs/wicked_pdf.

Source

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

        def to_s
          IO.read(path)
        end

        def filename
          path.to_s
        end
      end

      class PropshaftAsset < LocalAsset
        def to_s
          Rails.application.assets.resolver.read(path)
        end
      end

      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

View on GitHub (pinned to bce498de54)

When it happens

Trigger: Thrown at lib/wicked_pdf/wicked_pdf_helper/assets.rb:71 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/e9270834d5b90b48. Report an issue: GitHub.