Email Queue getting error due to IOError('wkhtmltopdf reported an error:\n' + stderr)

Hi All,

I am facing issue while sending email. PFB error

FYI if I open the queue and click send it is working while sending through the scheduler facing issue.

  File "/home/mgmtapp/frappe/frappe-bench/apps/frappe/frappe/email/doctype/email_queue/email_queue.py", line 167, in send
    message = ctx.build_message(recipient.recipient)
  File "/home/mgmtapp/frappe/frappe-bench/apps/frappe/frappe/email/doctype/email_queue/email_queue.py", line 315, in build_message
    message = self.include_attachments(message)
  File "/home/mgmtapp/frappe/frappe-bench/apps/frappe/frappe/email/doctype/email_queue/email_queue.py", line 392, in include_attachments
    print_format_file = frappe.attach_print(**attachment)
  File "/home/mgmtapp/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 2225, in attach_print
    else get_print(doctype, name, **kwargs)
  File "/home/mgmtapp/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 2184, in get_print
    return get_pdf(html, options=pdf_options, output=output) if as_pdf else html
  File "/home/mgmtapp/frappe/frappe-bench/apps/frappe/frappe/utils/pdf.py", line 90, in get_pdf
    filedata = pdfkit.from_string(html, options=options or {}, verbose=True)
  File "/home/mgmtapp/frappe/frappe-bench/env/lib/python3.10/site-packages/pdfkit/api.py", line 75, in from_string
    return r.to_pdf(output_path)
  File "/home/mgmtapp/frappe/frappe-bench/env/lib/python3.10/site-packages/pdfkit/pdfkit.py", line 201, in to_pdf
    self.handle_error(exit_code, stderr)
  File "/home/mgmtapp/frappe/frappe-bench/env/lib/python3.10/site-packages/pdfkit/pdfkit.py", line 155, in handle_error
    raise IOError('wkhtmltopdf reported an error:\n' + stderr)

Please help to resolve the issue.

Hmm, I think I encountered the same problem once, but I don’t remember what the issue was. It be worth it to take a look at the Print Format, and check that there are no private files/inaccessible files.

There is also a bench/logs/wkhtmltopdf.log file

I couldnt able to resolve this issue. Getting error while sending the entire doctype
:frowning:

@balramrjpm please check this link.

Thanks for the response,
Could you please let me know is this solution applicable for the prod instance as well i.e., by adding the “host_name”:“http://127.0.0.1:8000” to the site config file

No in production you check only wkhtmltopdf version is 12.6 with (patch qt) or not

Hi,
Update the wkhtmlpdf and try