Data Recovery & Error Isolation

Failed Data Rows Architecture & Isolated Row Recovery

Capturing, diagnosing, and retrying rejected spreadsheet rows with surgical precision without re-running entire imports.

Frexten Engineering Team
Updated 2026-11-20

Article Overview

  • Category: Data Recovery, Error Isolation & Fault Tolerance
  • Audience: Store Owners, Digital Agencies, Database Administrators & Technical Support
  • Applies To: NextGen Smart Data Importer (Community Free & Enterprise Pro Editions)
  • Purpose: Comprehensive architectural blueprint, technical reference, and user guide for capturing, diagnosing, and retrying failed spreadsheet rows without re-running the entire import.

1. Executive Summary

When importing thousands of WooCommerce products, blog articles, users, or custom post types from large CSV, Excel, or XML files, individual rows often fail due to localized data anomalies:

  • A single product in row 42 is missing a mandatory SKU.
  • A user in row 118 has an invalid email format.
  • A database temporary deadlock occurs during a concurrent checkout while importing row 315.
  • A taxonomy term or parent relationship could not be resolved at that exact second.

In traditional WordPress importers, a user faced with 3 failed rows out of a 1,000-row catalog has only bad options:

  1. Re-import the entire spreadsheet: High risk of overwriting prices or post modifications made since the import started, creating duplicates, and wasting server resources.
  2. Manually edit and build a sub-CSV: Tedious, error-prone, and time-consuming.
  3. Manually recreate the 3 items in wp-admin: Impractical for stores with frequent batch syncs.

NextGen Smart Data Importer introduces the Isolated Row Recovery Engine. Instead of discarding rejected data or failing the entire import, NextGen isolates each failed row into a dedicated database ledger (wp_nextgen_import_failed_rows), records the exact validation error, and allows store owners to retry all failed rows with 1 click or automatically through Action Scheduler with exponential back-off.


2. Why Individual File Data Rows Fail

Architecture Flowchart
flowchart TD File["1,000 Row CSV / Excel Feed"] --> Parser["Streaming Chunk Parser"] Parser --> Valid["997 Rows Successfully Inserted"] Parser --> Rejection["3 Rows Fail Validation or DB Insertion"] subgraph Failures["Common Data Row Rejection Causes"] E1["1. Missing Required Fields (Empty Post Title or SKU)"] E2["2. Data Type & Schema Errors (Text in numeric Price field)"] E3["3. Transient DB Deadlocks (MySQL 1213 Lock wait timeout)"] E4["4. Unresolved Relationships (Missing parent category/attribute)"] end Rejection --> E1 Rejection --> E2 Rejection --> E3 Rejection --> E4

NextGen’s non-blocking pipeline treats errors with surgical isolation:

  • Fail-Safe Ingestion: 997 rows finish importing immediately and publish to the live site.
  • Forensic Ledgering: The 3 rejected rows are stored with their full raw row data and diagnostic error messages.

3. Dedicated Database Architecture (wp_nextgen_import_failed_rows)

Failed data rows are stored in a dedicated, high-performance table created upon plugin activation:

sql
CREATE TABLE wp_nextgen_import_failed_rows (
    id bigint(20) NOT NULL AUTO_INCREMENT,
    import_id varchar(100) NOT NULL,
    row_data longtext NOT NULL,
    error_message text NOT NULL,
    retry_count int DEFAULT 0,
    next_retry datetime DEFAULT NULL,
    created_at datetime DEFAULT CURRENT_TIMESTAMP,
    PRIMARY KEY  (id),
    KEY import_id (import_id),
    KEY next_retry (next_retry)
);

Table Schema Breakdown

Column Name Data Type Purpose in Row Isolation & Recovery
id BIGINT(20) AUTO_INCREMENT Unique primary key for the failed row entry.
import_id VARCHAR(100) Links the failed row directly to the parent import session card in Recent Imports.
row_data LONGTEXT Complete Raw Row Data: JSON-encoded array containing the exact key-value pairs from the imported CSV/Excel/JSON row.
error_message TEXT Forensic Error Reason: Captures the exact WP_Error or database exception (e.g., Missing mandatory field 'post_title', Duplicate SKU 'SHIRT-BLK').
retry_count INT Counter tracking how many retry attempts have been executed (starts at 0, capped at 5).
next_retry DATETIME Scheduled timestamp for the next automated retry attempt (governed by exponential back-off).
created_at DATETIME Audit timestamp when the failure initially occurred.

4. How the Isolated Row Recovery Engine Works

Sequence Diagram
sequenceDiagram autonumber actor Admin as Store Owner / Agency Admin participant UI as Recent Imports (Session Card) participant API as /retry-failed-rows/{import_id} participant DB as wp_nextgen_import_failed_rows participant AS as Action Scheduler Queue participant Importer as NextGen_Base_Importer participant Parent as wp_nextgen_imports participant Log as server_side.log (Same File) Admin->>UI: Clicks "⚠️ Failed Rows" Pill in Card Footer UI->>API: POST /wp-json/nextgen-importer/v1/retry-failed-rows/{import_id} API->>AS: as_enqueue_async_action('nextgen_import_retry_failed_rows') API-->>UI: { success: true, message: "Retry job scheduled." } Note over AS,Importer: Action Scheduler worker (handle_retry_worker) executes in background AS->>DB: SELECT * WHERE import_id = ? AND retry_count is under 5 AS->>Importer: Reconstructs mapping & calls import_row($row_data) alt Row Import Succeeds Importer->>DB: DELETE FROM wp_nextgen_import_failed_rows WHERE id = ? Importer->>Parent: UPDATE success_count = success_count + 1, failed_count = failed_count - 1 Importer->>Log: Appends: "[RETRY] Row #14 successfully processed after retry." else Row Fails Again Importer->>DB: UPDATE retry_count = retry_count + 1, next_retry = +4 min, error_message = ? Importer->>Log: Appends: "[RETRY] Row #14 failed again (Attempt 2): SKU already exists." end

The 4-Step Execution Anatomy:

  1. Trigger via REST API:
    Clicking Retry All Failed triggers POST /wp-json/nextgen-importer/v1/retry-failed-rows/{import_id}.
  2. Asynchronous Dispatch:
    The API schedules an Action Scheduler job (nextgen_import_retry_failed_rows), freeing the browser immediately.
  3. Surgical Re-Processing:
    The worker (handle_retry_worker) loads the original field mappings and import settings associated with that import_id, parses the JSON row_data, and passes it to the target entity importer.
  4. Automated State & Counter Resolution:
    • On Success: The row is deleted from the failed rows ledger, the parent session counters dynamically update (success_count + 1, failed_count - 1), and the live UI reflects the updated counts.
    • On Failure: The worker increments retry_count, calculates an exponential back-off delay ($2, 4, 8, 16, 30$ minutes), and updates next_retry.

5. Log Continuity: Appended to the Exact Same Log File

NextGen does not generate disconnected log files for retries. All retry attempts, error traces, and success notices are appended directly to the original session log:

  • Canonical Path:
    /wp-content/uploads/nextgen-imports/{import_id}/logs/server_side.log
  • Multisite Support:
    Resolves automatically to /wp-content/uploads/sites/{blog_id}/nextgen-imports/{import_id}/logs/server_side.log.

Real-World Log Stream Sample

log
[2026-11-19 02:52:04] [SYSTEM] Import finished. 997 rows succeeded, 3 rows rejected.
[2026-11-19 02:55:10] [SYSTEM] Manual row retry triggered for session import_6afe0ff4119d2...
[2026-11-19 02:55:12] [RETRY] Row #14 successfully processed after retry. (Post #4012 created)
[2026-11-19 02:55:14] [RETRY] Row #42 successfully processed after retry. (Post #4013 created)
[2026-11-19 02:55:16] [RETRY] Row #89 failed again (Attempt 2): SKU 'TSHIRT-RED' already exists.

6. User Interface Walkthrough (Dedicated Modal Architecture)

To inspect and retry failed data rows in the WordPress Admin or Standalone Next.js UI:

Every session card in the Recent Imports ledger maintains clean status pills in its footer:

  • Interactive Failed Rows Pill: When an import rejects records, an alert badge appears: ⚠️ {failed_count} Failed Rows.
  • Direct Trigger: Clicking the pill opens the Dedicated Failed Rows Recovery Modal (createPortal), avoiding inline table accordion clutter.
text
┌────────────────────────────────────────────────────────────────────────────────────────┐
│  📦 catalog.csv | WooCommerce Products | 997/1,000 Processed | 3 Failed                │
│                                                                                        │
│  [Source File] [View Log] [1 User] [🖼️ 120 Media] [⚠️ 3 Failed Rows] ◄── Click to Open│
│                                                          │                             │
│                                                          ▼                             │
│                                            Opens Failed Rows Modal                     │
└────────────────────────────────────────────────────────────────────────────────────────┘

Layer 2: Dedicated "Failed Rows Recovery" Modal

Clicking the ⚠️ Failed Rows pill launches a full-featured inspection dialog:

text
┌────────────────────────────────────────────────────────────────────────────────────────┐
│  ⚠️ FAILED ROWS RECOVERY                       [ 📥 Export CSV ]           [ ✕ Close ] │
│  Session: imp_6afe0ff4119d2 • File: catalog.csv • 3 Failed Rows                        │
├────────────────────────────────────────────────────────────────────────────────────────┤
│  ┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐   │
│  │ 1,000 TOTAL ROWS │ │ 997 SUCCEEDED    │ │ 0 PENDING        │ │ 3 FAILED         │   │
│  └──────────────────┘ └──────────────────┘ └──────────────────┘ └──────────────────┘   │
│                                                                                        │
│  🔍 [ Filter failed rows by row #, error reason, or data snippet...                 ]  │
│                                                                                        │
│  REJECTED DATA ROWS (3):                                                               │
│  ┌──────────────────────────────────────────────────────────────────────────────────┐  │
│  │ Row #14 • Attempt 1/5                                         [ 📄 View JSON ]   │  │
│  │ ⚠️ Missing mandatory field 'post_title'                       [ 🔄 Retry Row ]   │  │
│  │ Next retry scheduled in 2 minutes                                                │  │
│  └──────────────────────────────────────────────────────────────────────────────────┘  │
│  ┌──────────────────────────────────────────────────────────────────────────────────┐  │
│  │ Row #42 • Attempt 0/5                                         [ 📄 View JSON ]   │  │
│  │ ⚠️ Temporary lock wait timeout (MySQL 1213)                   [ 🔄 Retry Row ]   │  │
│  │ Next retry scheduled: Immediate                                                  │  │
│  └──────────────────────────────────────────────────────────────────────────────────┘  │
│  ┌──────────────────────────────────────────────────────────────────────────────────┐  │
│  │ Row #89 • Attempt 2/5                                         [ 📄 View JSON ]   │  │
│  │ ⚠️ Term 'Running Shoes' could not be mapped to taxonomy       [ 🔄 Retry Row ]   │  │
│  │ Next retry scheduled in 4 minutes                                                │  │
│  └──────────────────────────────────────────────────────────────────────────────────┘  │
│                                                                                        │
│  Showing 1 - 3 of 3 failed rows                                                        │
├────────────────────────────────────────────────────────────────────────────────────────┤
│  [ Close ]                                        [ 🔄 Retry All Failed Rows (PRO) ]   │
└────────────────────────────────────────────────────────────────────────────────────────┘
  1. 4-Stat Metrics Header: Displays Total, Succeeded, Pending, and Failed rows at a glance.
  2. Search Filter & Pagination: Instant keyword filtering across row numbers and error descriptions with 10-per-page pagination.
  3. Forensic JSON Payload Viewer: Clicking [ 📄 View JSON ] opens a secondary raw payload inspector with a 1-click Copy to Clipboard button, allowing developers to inspect exact column values.
  4. Individual & Bulk Retries:
    • Click [ 🔄 Retry Row ] on an individual row for isolated recovery.
    • Click [ 🔄 Retry All Failed Rows ] in the footer to dispatch the automated Action Scheduler worker.
  5. CSV Ledger Export: [ 📥 Export CSV ] downloads an export file of all rejected rows with error diagnostics for offline correction.

7. Architectural Comparison: Failed Data Rows vs. Failed Media Downloads

NextGen employs two specialized recovery engines designed for their specific data domains:

Dimension 📄 Failed Data Rows Engine 🖼️ Failed Media Recovery Engine
Problem Solved Entity insertion rejected (post, product, user). Entity created, but remote image sideloading failed.
Dedicated Database Table {$wpdb->prefix}nextgen_import_failed_rows {$wpdb->prefix}nextgen_image_queue
Stored Information Raw JSON row data (row_data), error string. Post ID, remote URL, image type, error string.
Trigger Location Failed Rows Modal ➔ [ 🔄 Retry All Failed Rows ] Media Health Modal ➔ [ ⚡ 1-Click Retry All Failed Images ]
Worker Engine Action Scheduler (nextgen_import_retry_failed_rows) Cron Micro-batch Worker (NextGen_Image_Processor)
Retry Strategy Exponential Back-Off ($2, 4, 8, 16, 30$ mins, max 5) Sequential batches of 50 images with hash lookups.
Success Action Inserts post, removes from failed rows table, updates session counters. Attaches to post_thumbnail or gallery, sets status to 'completed'.
Audit Log Destination Appends to logs/server_side.log. Appends to logs/server_side.log.
WP-CLI Support wp nextgen list --status=failed wp nextgen log <import_id>

7.1 Freemium Tiering: Free Community vs. Pro Enterprise

NextGen balances WordPress.org compliance and enterprise conversion through a balanced two-tier model:

Capability Community (Free Edition) Enterprise (Pro Edition)
Failure Counter Badge ✅ Full visibility (2 Failed Rows) ✅ Full visibility
Forensic Diagnostics Table ✅ Inspect row number, error string, and rejected field ✅ Full inspection table
Session Log Failure Trail ✅ Visible in logs/server_side.log ✅ Full continuous log
[ 🔄 Retry All Failed ] Action 🔒 Locked (<ProBadge /> upgrade prompt) ⚡ 1-Click Instant Background Trigger
Action Scheduler Engine ❌ Manual re-upload or sub-CSV ⚡ Automated Exponential Back-off Worker
Parent Counter Auto-Sync ❌ N/A ⚡ Dynamic failed_count decrement
  • Why Free Gets Diagnostics: WordPress.org strictly requires that community plugins do not obscure error messages or fail without explaining why. Merchants can always see the exact error and manually correct their spreadsheet.
  • Why Pro Unlocks 1-Click Recovery: The automated Action Scheduler background worker, exponential retry back-off queue, and atomic session counter updates are premium automation tools designed for busy digital agencies and large e-commerce merchants.

8. Frequently Asked Questions (FAQ)

Q1: Will retrying failed rows duplicate my existing products?

No. Retrying failed rows only processes the specific rows stored in wp_nextgen_import_failed_rows. The 997 already imported posts are completely ignored and untouched.

Q2: What happens if I fix an issue on my site (e.g. create a missing taxonomy term)?

Once you create the missing category or fix a conflicting SKU in WordPress, simply click [ 🔄 Retry All Failed ]. The worker will re-evaluate the row, find the category, successfully publish the entity, and remove it from the failed list.

Q3: Does this work in Standalone (Next.js) dev mode?

Yes. Standalone mode simulates failed row ingestion and interactive retries through devImportStore.ts and mock API states.