Errors
BladePDF errors can happen before the request is sent, while the API validates the render, or while the PDF is being generated. Handle them explicitly so your app can retry safely or show useful feedback.
Package exceptions
| Exception | Cause |
|---|---|
MissingApiKeyException |
BLADEPDF_API_KEY is empty. |
AssetNotFoundException |
A manually attached asset path does not exist. |
InvalidRenderConfigurationException |
The fluent API was used in an unsupported combination, such as header HTML on a cloud template render or async() without storePdf(). |
RenderFailedException |
BladePDF returned a non-successful HTTP response. |
Handling exceptions
1use BladePDF\Laravel\Exceptions\BladePdfException;
2use Illuminate\Support\Facades\Log;
3
4try {
5 return BladePDF::fromTemplate('invoice.standard', $context)
6 ->reference($invoice->uuid)
7 ->render()
8 ->download('invoice.pdf');
9} catch (BladePdfException $e) {
10 Log::warning('BladePDF render failed', [
11 'invoice_id' => $invoice->id,
12 'message' => $e->getMessage(),
13 ]);
14
15 return back()->withErrors([
16 'pdf' => 'The PDF could not be generated. Please try again.',
17 ]);
18}
API status codes
| Status | Meaning | Typical fix |
|---|---|---|
400 | Invalid render request. | Check source, context, metadata, options, and required files. |
401 | Missing authentication. | Set BLADEPDF_API_KEY. |
403 | The API key is not allowed to render. | Check API key, account, and plan status. |
408 | Render timed out. | Reduce complexity or increase plan/render timeout if available. |
413 | Payload is too large. | Reduce HTML/context/assets size. |
429 | Concurrency or queue limit reached. | Retry later with backoff or lower concurrency. |
500 | Unexpected render failure. | Check dashboard logs and retry if safe. |
508 | Daily bandwidth limit reached. | Wait for reset or adjust plan. |
509 | Monthly bandwidth limit reached. | Wait for reset or adjust plan. |
Common validation errors
Missing main html input file.The request wassource: htmlbut no HTML file was sent.Missing context input file.The request wassource: templatebut no context JSON file was sent.HTML file fields are not supported for template render source.Cloud template renders cannot includehtml,header_html, orfooter_html.metadata.template_name is only supported for html render source.Usereference()for cloud templates.waitUntil option requires waitFunctionUsewaitFunction()whenwaitUntil('function')is set.Asynchronous renders require store_pdf=true.CallstorePdf()beforeasync().Asynchronous renders require available PDF storage...Free workspace storage before submitting another async render.
Render limit errors
BladePDF enforces limits for render time, PDF size, payload size, network access, and asset requests. Limit errors appear in dashboard logs and are delivered through pdf.failed webhooks.
Safe retries
Retrying is usually safe when your render operation has no side effects. Use your own idempotency key or reference() value to avoid duplicate downstream work.
1BladePDF::fromTemplate('invoice.standard', $context)
2 ->reference($invoice->uuid)
3 ->render()
4 ->pdf();
Debugging
Every render appears in the dashboard with request id, logs, timing metrics, asset counts, failure message, and template/reference metadata. Start there when a render fails in production.