A count is only part of the check
If you expected three records and received three, the total looks right. But one record can be missing while another appears in its place.
| Expected | Completed |
|---|---|
| DEMO-A | DEMO-A |
| DEMO-B | DEMO-B |
| DEMO-C | DEMO-Z |
Result: DEMO-C is missing and DEMO-Z is unexpected. The workflow stops with an error so this batch cannot be mistaken for a match.
The check compares exact string IDs and ignores order. It also rejects repeated IDs in either array. That can reveal a repeated completion even when the total stays the same.
Try the two-minute demo
- Download the JSON file and import it into n8n. Execute Run the demo. The healthy example completes with the same three IDs in a different order.
- Open Choose a demo. Change
demoCasefromhealthytowrong_idsand execute again. This run should fail at Stop on incomplete or duplicate work. - Open Reconcile record IDs to see
missingIds,unexpectedIdsand any duplicates. You can also trymissing,duplicatesandempty.
The errors in these demos are intentional. The workflow uses fictional IDs, runs locally, and contains no HTTP node, credentials or telemetry. It does not need a Keptick account.
Connect one complete batch
Capture the expected IDs before processing. Build completed IDs from confirmed downstream results, such as verified writes, rather than attempted inputs. Compare once after the entire batch or loop has finished.
Pass one item with this shape, including when nothing completed:
{
"expectedIds": ["DEMO-A", "DEMO-B", "DEMO-C"],
"completedIds": [],
"allowEmptyExpected": false
}If an earlier node returns zero n8n items, later nodes may not run. Keep this envelope on a control path that reaches the check. If you deliberately use Always Output Data, rebuild the envelope afterward: an empty object alone is invalid.
Use nonblank strings, with at most 10,000 IDs in each array. Comparison does not trim spaces, fold case or convert numbers. Map numeric IDs explicitly on both sides. Empty expected IDs fail unless you intentionally set allowEmptyExpected to true. If filtering is part of your workflow, define the expected eligible batch before processing.
Keep the result in context
A match proves that the supplied ID arrays cover the same records without duplicates. It does not verify record contents, database commits, exactly-once effects or that you chose the correct expected batch. The quality of the result depends on where those arrays come from.
A separate n8n error workflow can react to a failed automatic execution. Manual test executions do not trigger an Error Trigger workflow, and this reconciliation cannot detect a workflow that never starts or never reaches the check.
Add missing-run monitoring when needed
Use independent monitoring when a scheduled batch must arrive. Keptick stores outcome receipts and can flag missing runs or counts below your threshold. Send a receipt only after verifying completed work, and test the failure path before relying on alerts.
The first monitor can stay free within its allowance of 500 outcomes per day. Missing-run checks start about every five minutes; processing and email can add delay. The download remains usable on its own.
Read the monitoring setup guide, or use the empty-output guide when a minimum distinct count is the check you need.
Tested behavior and sources
The workflow logic was tested in n8n 2.38.7: one successful execution, four intentional failure cases, and 22 checks of input boundaries.
- n8n error handling ↗
Error workflows, Error Trigger behavior and Stop And Error. Check the documentation for your n8n version.
- View the original template contribution ↗
Original workflow source and validation notes.
Made by Keptick with AI assistance. Not affiliated with n8n. Review execution data before sharing it.
Start with the records you expected.
Run the healthy example, then the deliberately mismatched batch. Connect real results only after both behave as expected.