Run a PDF workflow in n8n and recover a partial job
18 April 2026
A retry should recover the existing PDF job before requesting another result. In this example, n8n submits a synthetic file, recovers from a lost acknowledgement and stops when the destination refuses the write. Running the same workflow again saves the result. A third run returns the same file. The nine-node workflow and its loopback service are available to run locally.
Which identities must survive a retry?
Identify the document and the job
Consider a team that requests a review copy of a stored PDF. The proposed workflow starts with an approved source reference, acquires the file, submits it to a processing API, waits for completion and returns the derivative to a review folder. The team needs evidence of what happened when any stage fails.
Choose the initial trigger deliberately. A manual synthetic trigger makes the first proof of concept easier to inspect. A later file-change or webhook trigger needs its own access, duplicate-delivery and recovery tests. Treat that expansion as a changed contract, even if most processing nodes remain the same.
Scope of the local test
The downloadable workflow was imported into n8n 2.46.4, executed three times through its Server CLI and exported with its node definitions and connections verified. The HTTP API in this exercise is a local simulator that accepts one specific fictional PDF and returns a different, fixed review copy. No third-party account or document processor is needed. An actual service would need independent checks of conversion quality and access controls.
Set credentials and execution prerequisites
Official n8n execution/credential documentation
n8n's HTTP Request node can call REST APIs and supports sending binary file data in a multipart request by selecting the relevant input field. That supplies a generic integration mechanism; the selected PDF API determines its request format and authentication. Read the HTTP Request node documentation.
Configure credentials through the supported credential mechanism. n8n documents predefined and generic authentication choices and says the method must match the target service. Its credential reference should be checked alongside the provider's API specification. A successful unauthenticated test endpoint does not establish access to a protected document service.
| Prerequisite | Record before implementation |
|---|---|
| Runtime | n8n version, hosting arrangement and execution mode |
| Source | Permitted document ID, revision and binary acquisition route |
| API | Exact operation, schema, authentication and limits |
| Binary field | Agreed field name and expected MIME type |
| Destination | Approved location and connection identity |
| Evidence | Job register, execution references and retention policy |
Plan binary storage as part of capacity. Confirm the active storage mode, worker access, pruning and limits in the exact deployment you intend to use. A successful single-process test with small PDFs leaves queue-mode storage and large-file behaviour open. n8n binary-data guidance.
Run the nine-node PDF workflow
Start the fixture
Download the workflow and Python fixture server. The bundle includes the importable workflow, run instructions and an execution receipt. Use an isolated n8n instance and an empty test database. The fixture binds to port 58147 on the loopback interface and accepts the synthetic source SYN-DOC-01, revision 2. It rejects unexpected input bytes.
The first HTTP node fetches the PDF as the binary field input_pdf. The next submits that field with a stable key identifying the source, revision, operation and destination. The simulator stores the key in SQLite and returns a deliberate HTTP 503 after accepting the first job. The node retries once using the same key and recovers lab-job-01.
| From | Condition | Next step |
|---|---|---|
| Source reference and input_pdf | Always | Input and routing valid? |
| Input and routing valid? | No | Owned review queue |
| Input and routing valid? | Yes | Submit and retain remote job ID |
| Submit and retain remote job ID | Always | Reconciled service outcome |
| Reconciled service outcome | Failed or uncertain | Owned review queue |
| Reconciled service outcome | Succeeded | Check output and destination write |
If the API responds asynchronously, wait or reconcile through the supported status mechanism. An accepted request should not pass directly to a result-upload node. Once a terminal success is verified, retrieve the authorised output, apply the operation's checks and write it to the approved destination. Read back the destination reference before marking the business job complete.
The output record should contain the source ID and revision, input checksum, operation configuration, remote job ID, n8n execution reference, result checksum and destination ID. Include a separate quality decision. This allows an operator to distinguish “service finished” from “result passed review”.
The wider ten-case acceptance worksheet remains a template for the complete deployment. The three-run receipt separately records what the lab actually exercised.
| n8n execution | Observed outcome | Destination |
|---|---|---|
| 1 | The retry recovered the accepted job. The destination then returned HTTP 403. | No file created |
| 2 | The same job completed and the destination returned HTTP 201. | One saved PDF |
| 3 | A duplicate trigger received HTTP 200 for the existing destination. | Still one saved PDF |
Inspect the execution receipts
All three executions used the same business key. The independent fixture log contains 18 HTTP events, one job and one saved PDF. Its stored bytes contained the expected review-copy marker, and the successful workflow receipts returned the same SHA-256 digest. The simulator enforces idempotence. A provider with different retry semantics, or a destination that creates new files on every write, would need a different recovery design.
Handle retries and exceptions
Partial runs, duplicates and manual review
A retry of an execution is not necessarily a new business request. Recover the existing job key and remote job ID before repeating submission. If the previous call timed out after the service accepted it, creating a fresh job may duplicate work. If destination writing succeeded but its response was lost, reconcile that output before uploading again.
n8n supports an error workflow configured in Workflow Settings, starting with an Error Trigger. Its documentation also explains that available execution details differ when failure occurs in the trigger itself. See the error-handling guide. Design the exception record so it remains useful when an execution URL is unavailable.
Handle business failures explicitly. A service may return a valid response body describing a failed PDF job; the HTTP node can have completed its request successfully while the document operation failed. Route that state to a defined review or failure path. Do not rely solely on a node turning red.
Give each exception a reason, owner and permitted next action. Missing input requires acquisition repair. Invalid content may need a replacement document. A denied destination requires an access decision. Keep these separate from temporary network failures that may qualify for bounded retries. Human review should resume the original business job with an audit record rather than bypass its provenance.
Acceptance checklist for an n8n PDF processing workflow
Synthetic tests and sensitive-data exposure
Run the worksheet against an original synthetic PDF whose expected output can be inspected independently. Start with one document, then add multiple items to test whether metadata remains paired with the correct binary file. A workflow can appear successful while an expression accidentally references another item's content.
Verify the following evidence:
- Each input retains its source reference through submission and retrieval.
- Duplicate intake recovers the existing business job.
- A missing or incorrect binary field stops before processing.
- A failed or incomplete remote job cannot enter the release path.
- A partial run can recover without repeating an already completed side effect.
- Destination access is tested with the actual runtime identity.
- Execution views, error records and exports do not expose credentials or unnecessary document content.
Use a capacity estimate to shape testing, not as a performance claim. For example, 24 simultaneous 12 MB inputs represent 288 MB of source bytes before outputs and processing overhead. That arithmetic is not an n8n memory measurement. Observe the selected deployment with representative files, then set concurrency and binary-retention controls from evidence.
Review what remains in execution history after completion and failure. Keep enough identifiers to diagnose work while applying the organisation's retention and access rules to document bytes. Test cleanup in the chosen storage mode instead of assuming one setting removes every historical copy.
Deploy and maintain the workflow
Version control, rollback and support ownership
Version the exact export used for a test and compare the saved graph with the file you intend to release. This lab keeps the workflow inactive, uses no stored credentials and points only to its loopback simulator. The Server CLI documentation covers importing, executing and exporting workflows. A production variant should review source, destination, node permissions and authorised secrets before activation.
Assign a workflow owner, credential owner and business exception owner. Rehearse credential expiry and the departure of the person who originally configured the flow. A technical runbook should explain how to pause intake, inspect outstanding jobs and resume them safely.
For rollback, restore a reviewed workflow version while preserving the job register. Decide how in-flight requests created by the newer version will be reconciled. Repeat the lost-acknowledgement, denied-write and duplicate-trigger cases whenever a new API or destination changes the recovery contract.
Sources
Published by Arke Technologies (Pty) Ltd, Johannesburg. Drafted with ChatGPT. Editorial and technical checks by Kairos (Codex).
