Agent Applies the Wrong Schema to an Old Template Version: Causes and Fixes
Agent Extracts Fields Using a Schema That Doesn't Match the Document's Template Version
6 patterns for this goal
Document classification fails when a pipeline cannot correctly determine what a document is, where it starts and ends, or which schema applies, before extraction ever begins. The root causes split into three distinct problems — pages that don’t map cleanly onto document boundaries (blank pages, embedded attachments, scrambled multi-page batches), documents that look structurally identical to a different type or version (invoice vs. purchase order, 2023 template vs. 2024 template), and quality gates that reject readable-but-degraded input. Classification failures matter because every downstream extraction step inherits whatever the classifier got wrong — a purchase order routed through an invoice schema extracts nothing meaningful, since “Amount Due” doesn’t exist on a PO.
All 6 patterns converge on the same two-part fix: combine multiple weak signals into a single confidence score, then route only the low-confidence cases to human review rather than gating on any one signal alone. Boundary detection fuses separator sheets, first-page indicators, and continuity analysis because each fails in different scenarios; type confusion fuses header-term detection with field-presence validation because layout alone can’t distinguish an invoice from a PO; version confusion fuses template fingerprinting with date-based fallback because senders don’t always retire old templates cleanly; and quality rejection replaces a binary threshold with per-channel calibration plus a tiered enhanced-processing path. In every pattern, the mitigation explicitly rejects a single hard-coded rule or threshold in favor of a confidence-scored, multi-signal decision with a human-review escape valve for the ambiguous middle.
Similar-templates is confusion between different document types that share a layout — classifying a purchase order as an invoice. Version-confusion is confusion between different versions of the same document type from the same sender — correctly classifying something as an invoice but applying the wrong (e.g., 2023 vs. 2024) field-position schema to it.
Version-confusion is a per-document routing problem: a single document needs the right schema version selected from a registry of known variants. Template drift in Production Reliability is a fleet-level monitoring problem: detecting, at the pipeline level, that a sender has started using an unrecognized template across many documents and the registry itself needs updating.
Both directions trace back to the same missing signal: an explicit document boundary marker. Without separator sheets or a reliable first-page indicator, continuity/header-matching analysis has to infer boundaries from content similarity, and it either over-trusts weak similarity (under-splitting, merging two documents) or under-trusts a false discontinuity (over-splitting one document into several).
Not without a cost. The quality-rejection pattern shows that tightening a global quality threshold reduces bad input reaching extraction but also rejects legitimate, readable documents (a readable fax) — the actual fix is per-channel calibrated thresholds plus a tiered enhanced/manual-assist path, not a single stricter global cutoff.
Similar-templates misclassification is typically the most damaging because it doesn’t just delay processing — it actively runs the wrong extraction schema, extracting nothing meaningful from fields that don’t exist on the actual document type (no “Amount Due” on a PO) and can route a document into the wrong business workflow entirely (a PO sent to an AP payment workflow).
| Pattern | Mechanism |
|---|---|
| Blank Pages | Blank/near-blank or signature-only pages classified as a document type or flooding review |
| Embedded Documents | Attachment inside a container file classified only as the container, swallowing the nested document |
| Page Grouping | Batch-scan pages incorrectly split, merged, or scrambled across document boundaries |
| Quality Rejection | Overly aggressive quality gate rejects legitimate low-fidelity (fax, copy) documents |
| Similar Templates | Shared layout/logo across document types (invoice vs. PO) defeats classification |
| Version Confusion | Correct type, wrong template-version schema applied to a drifted document layout |
Total: 6 patterns
Agent Extracts Fields Using a Schema That Doesn't Match the Document's Template Version
Agent Misclassifies Documents That Share Near-Identical Layouts
Agent Swallows Attachments and Embedded Documents Into the Parent Document's Classification
Quality Filter Rejects Readable Documents as "Unreadable"
Agent Classifies Blank or Near-Blank Pages as Real Documents
Agent Groups Batch-Scanned Pages Into the Wrong Documents