---
title: Historical Sync Issues
description: "Historical Sync rebuilds TrustLens customer profiles from your existing WooCommerce orders and refunds. It runs in small batches driven by your browser: while the Dashboard or **Settings → Data** page is open, it processes 10 orders per request and updates…"
url: "https://webstepper.io/docs/trustlens/troubleshooting/historical-sync-issues/"
updated: "2026-10-18"
category: Troubleshooting
---

# Historical Sync Issues

Historical Sync rebuilds TrustLens customer profiles from your existing WooCommerce orders and refunds. It runs in small batches driven by your browser: while the Dashboard or **Settings → Data** page is open, it processes 10 orders per request and updates the progress bar. When it works, it's transparent — the progress bar fills and the Dashboard reloads with your data. When it doesn't, the failure modes are in the browser loop, the server, or the data shape. This page covers diagnosis and fixes.

---

## Common Symptoms

- Sync doesn't start after clicking Start Historical Sync
- Sync starts but stalls partway through
- Sync completes but customer counts look wrong
- Sync runs but trust scores aren't being populated

---

## Symptom 1: Sync Doesn't Start

### Verify the Click Registered

After clicking **Start Historical Sync** (Dashboard or Settings → Data), you should see:

- The start button replaced by a progress bar ("0 of N orders processed")
- Or an error notice explaining why it couldn't start

"No orders found to sync." means there are no orders with the completed, processing, refunded or cancelled status. "Sync is already running." means a previous run is still marked as running — reload the page to resume it, or click **Stop Sync** and start again.

If nothing happened, the request may have failed. Check the browser console for JavaScript errors and try again.

### Verify the Batch Requests Are Running

Sync doesn't use Action Scheduler or WP-Cron — each batch is an AJAX request from the open page. Open your browser's developer tools (Network tab) and look for repeated `admin-ajax.php` requests with the action `wstl_process_sync_batch`. If they aren't being sent, a JavaScript error or a security plugin blocking admin-ajax is the likely cause.

---

## Symptom 2: Sync Starts but Stalls

The progress bar updates initially but stops moving.

### The Page Was Closed

Sync only advances while the Dashboard or Settings → Data page is open. Closing the tab, navigating away or letting the computer sleep pauses it. Reopen either page: if the status is still "Running," the progress bar appears and the sync picks up where it stopped.

### Batch Errors

If a batch request fails, an error notice appears and the start button comes back. Check:

- The browser's Network tab for the failing `admin-ajax.php` response ("Sync batch failed: …")
- The PHP error log for "Allowed memory size exhausted," timeouts or fatal errors

For memory exhaustion, raise the PHP memory limit. Add to wp-config.php:

```
define('WP_MEMORY_LIMIT', '512M');
define('WP_MAX_MEMORY_LIMIT', '512M');
```

Then reload the page to retry the same batch. If the status shows "Failed" on Settings → Data, the error is listed there; start the sync again.

### Database Lock Contention

On very busy stores, the sync's writes can contend with normal WooCommerce traffic. Symptoms:

- Sync slows dramatically during peak traffic hours
- Database deadlock errors in logs

Fix: run sync during off-peak hours. The batch size (10 orders per request) is fixed; there's no setting to change it.

### HPOS Migration In Progress

If WooCommerce is mid-HPOS-migration, finish the migration before running the sync, so TrustLens reads complete order data. Check under WooCommerce → Status → Scheduled Actions whether HPOS migration jobs are still running.

---

## Symptom 3: Sync Completes but Counts Look Wrong

The sync finishes ("Sync complete! N customers profiled"), but the customer counts in the Dashboard don't match your expectations.

### Check the Full-Confidence Order Threshold

Customers below the Full-confidence Order Threshold (Settings → General, default 3 orders) are listed and scored, but only return risk (weighted for the small sample), linked accounts and the account-age bonus affect their score — the other modules wait for more orders.

If most of your store's customers have only 1–2 orders each, most scores will sit near the starting score of 50 and your segment distribution will be heavily Normal.

### Check Order Statuses

Sync reads orders in the `completed`, `processing`, `refunded` and `cancelled` statuses. A customer's `total_orders` counts only completed orders and orders with a refund; processing orders build the profile but aren't counted yet, and cancelled orders count toward `cancelled_orders`. Pending, on-hold and failed orders are skipped.

Verify with a sample: pick a customer, count their completed and refunded orders in WooCommerce, compare to `total_orders` in TrustLens.

### Check Date Range

Sync processes all historical orders in those statuses — there's no date-range setting.

---

## Symptom 4: Sync Runs but Scores Aren't Populated

The sync completes, customer records exist, but trust scores all show 50.

### Module Toggles

If all detection modules are disabled, sync builds the customer records but no signals fire. Verify Settings → Detection — at least Return Abuse Detection and Order Tracking should be on.

### Score Calculation Is Queued

The sync writes each customer's stats, then queues their score recalculation as an Action Scheduler job (`trustlens/calculate_score`). If WP-Cron or Action Scheduler isn't running, those jobs stay pending and scores keep their starting value. See [Scores Not Updating](/docs/trustlens/troubleshooting/scores-not-updating/) Step 3.

Fix: get the queue running, or bulk Recalculate Score from the Customers list (it runs immediately, one page at a time).

---

## Symptom 5: Sync Repeatedly Fails on the Same Batch

The sync keeps failing at the same point — every retry stops at the same order count.

### Corrupted Order Data

Some old WooCommerce installations have orders with corrupted or missing data — null line items, malformed addresses, etc. The sync may not handle these gracefully.

Workarounds:

- Find the orders around that position (sync works through orders oldest first) and inspect them in WooCommerce; fix or delete if corrupted
- Check the PHP error log for the order ID in the failure
- Report the issue with the failing order's structure

There's no setting to skip individual orders.

### HPOS-Specific Issues

Some HPOS edge cases produce orders that look slightly different from legacy orders. Verify the failing order's HPOS state — is it fully migrated or partially?

---

## Symptom 6: Sync Completes Too Fast

You have 10,000 orders but the sync completes in 30 seconds. Suspicious.

Possible causes:

- Most orders are in statuses the sync skips (pending, on-hold, failed, drafts)
- HPOS / legacy table mismatch causing the wrong table to be queried
- The sync was skipped ("Skip and analyze new orders only") rather than run

Verify: spot-check by opening a known order's customer profile in TrustLens. Are they listed? Are their order count and refund stats correct?

---

## Rerunning Sync

Sync recomputes each customer's stats from their orders, so it's safe to rerun — it doesn't double-count.

1. Settings → Data → Start Historical Sync
2. Keep the page open until it finishes

A rerun processes every order again, so it takes about as long as the first run.

---

## Reset and Resync

If you suspect sync data is corrupted:

1. Back up the database
2. Remove the affected customers' TrustLens data with the Customers list's **Delete** bulk action (there's no one-click "delete all data" button)
3. Run Historical Sync again

This rebuilds from scratch. Disruptive but produces a clean slate.

---

## Sync Progress Visibility

While sync is running:

- The Dashboard shows a progress bar with the percentage and "X of Y orders processed"
- Settings → Data → Historical Data Sync shows the status (Running / Complete / Failed / Skipped), the same progress bar, and the last run time

Patience: sync of 100,000+ orders can take hours, and the page must stay open. Don't open the sync in several tabs at once — each tab sends its own batch requests.
