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

Could not find asset '#{source}'

Error message

Could not find asset '#{source}'

What it means

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

Source

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

        elsif source[0] != '/' && !source[0, 8].include?('://')
          source = [protocol, '://', source].join
        end
        source
      end

      def precompiled_or_absolute_asset?(source)
        !Rails.configuration.respond_to?(:assets) ||
          Rails.configuration.assets.compile == false ||
          source.to_s[0] == '/' ||
          source.to_s.match(/\Ahttps?\:\/\//)
      end

      def read_asset(source)
        asset = find_asset(source)
        return asset.to_s.force_encoding('UTF-8') if asset

        unless precompiled_or_absolute_asset?(source)
          raise MissingLocalAsset, source if WickedPdf.config[:raise_on_missing_assets]

          return
        end

        pathname = asset_pathname(source)
        if pathname =~ URI_REGEXP
          read_from_uri(pathname)
        elsif File.file?(pathname)
          IO.read(pathname)
        elsif WickedPdf.config[:raise_on_missing_assets]
          raise MissingLocalAsset, pathname if WickedPdf.config[:raise_on_missing_assets]
        end
      end

      def read_from_uri(uri)
        response = Net::HTTP.get_response(URI(uri))

        unless response.is_a?(Net::HTTPSuccess)

View on GitHub (pinned to bce498de54)

When it happens

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