Skip to content

theme dev: 6x request multiplier + Theme ID mismatch loop after first hot-reload upload (CLI 3.94.3) #7494

@anis-gha

Description

@anis-gha

Summary

shopify theme dev works on the very first page load, but as soon as any local file is saved (which triggers the CLI's automatic upload + hot reload), every subsequent navigator request is multiplied into 6 internal CLI requests to the same URL, all returning HTTP 200, ~1 second apart, then the CLI crashes with:

Theme ID mismatch: expected <dev_theme_id> but got <live_theme_id>.

The mismatch always reports the live theme (role: main) being served instead of the development theme created by theme dev.

Environment

CLI version @shopify/cli@3.94.3
Node v25.5.0
OS Windows 11 (PowerShell 7.4)
Shop Standard Shopify plan, public store
Apps that hook the request lifecycle WeTracked Connect (App Proxy /apps/wt-connect-pixel), ElevateAB (storefront A/B testing)

Steps to reproduce

  1. shopify theme dev --store=<store>.myshopify.com
  2. Open http://127.0.0.1:9292/ in a browser → first request loads correctly.
  3. Save any file in the theme (e.g. add a space to layout/theme.liquid).
  4. The browser hot-reloads. The CLI logs immediately show 6 GET requests to the same URL, ~1 s apart, then crash:
• 01:43:40 Request »    GET 200 / 553ms
• 01:43:41 Request »    GET 200 / 354ms
• 01:43:42 Request »    GET 200 / 265ms
• 01:43:44 Request »    GET 200 / 499ms
• 01:43:45 Request »    GET 200 / 658ms
• 01:43:46 Request »    GET 200 / 272ms
╭─ error ──
│ Theme ID mismatch: expected 195225911683 but got 187828208003.
│ Request ID: 40fe9f80-0d40-4569-8771-f8723a4105c7-1778179426

The "6 retries on a single nav request" pattern is consistent across reproductions: 1 navigator request → 6 internal CLI fetches of the same URL, all 200 OK, then the mismatch crash. This happens on every URL, not specific to alternate templates.

What I have tried (none fix the issue)

  • Updated CLI to latest (3.94.3).
  • --live-reload=off, --live-reload=full-page.
  • --theme=<id> explicit on theme dev.
  • Downgrading CLI to 3.80.x.
  • shopify auth logout + clearing %USERPROFILE%\AppData\Local\shopify-cli-nodejs + re-login.
  • Deleting and recreating the development theme (got a fresh ID, same bug).
  • Using a fresh navigator profile (private window, all cookies cleared).
  • Disabling the Web Pixel for WeTracked at the shop level.
  • Intercepting WeTracked App Proxy fetches (/apps/wt-connect-pixel/*) at the theme level via a theme.role != 'main' JS hook in <head> (so they never reach the network).
  • Disabling the ElevateAB redirect snippet on non-main themes.

After a fresh login, the dev server works for one page load, then the bug returns on the very next request following a file save.

Request IDs (for upstream investigation)

  • f4c637bf-63ac-431a-b776-d9d4594f38be-1778180399
  • 40fe9f80-0d40-4569-8771-f8723a4105c7-1778179426
  • 228d3bf1-3df9-4ff5-a985-3f8a1a4dea23-1778165507

Likely cause

The upload step on hot reload appears to invalidate the _shopify_essential cookie (or the upstream session that maps preview_theme_id to the dev theme). Subsequent retry attempts by the CLI never re-establish the dev-theme context — they get the live theme back from upstream instead. The 1 nav request → 6 CLI fetches multiplier suggests an internal retry loop on the mismatch detection that does not converge.

A confounding factor is that this shop has WeTracked installed (App Proxy responses on /apps/wt-connect-pixel/* set cookies). However, blocking those App Proxy responses entirely at the theme level (via fetch/XHR/sendBeacon hooks gated on theme.role != 'main') does not fix the bug. The mismatch still occurs after the first hot-reload upload, even when no wt-connect-pixel request reaches the network.

Related issues

Workaround currently in use

Switched from theme dev to a custom PowerShell FileSystemWatcher + theme push --only=<file> script with debouncing. This bypasses the proxy entirely and is stable, at the cost of losing hot-reload (manual F5 needed).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions