Skip to content

[Bug]: theme dev --theme-editor-sync re-downloads config/settings_data.json every ~45s when it contains a "/" (checksum mismatch) #9072

Open

Description

@wangliuyang6666

Environment

  • Shopify CLI 4.9.4 (Homebrew), Node v24.19.0, macOS 26.5.2
  • shopify theme dev --theme-editor-sync against a development theme with ~540 files
  • Slow link to Shopify (Taiwan): each Admin API request takes ~5 s

What happens

While theme dev runs with editor sync, this pair repeats every 40–50 seconds, forever:

• 16:05:58 Synced » download config/settings_data.json from remote theme
• 16:06:04 Synced » update config/settings_data.json
  • The file content never changes; every write is byte-identical.
  • Each write triggers a live reload on 127.0.0.1:9292, so the preview page keeps refreshing.
  • The remote file isn't changing either: in the Admin API, theme.files(filenames: ["config/settings_data.json"]) keeps the same checksumMd5 and updatedAt the whole time, even across the CLI's own update uploads.

Root cause (as far as I can tell)

For config/settings_data.json, the CLI computes its local checksum by stripping the leading /* … */ comment, removing whitespace outside strings, then taking the MD5. Shopify's checksumMd5 for this file is the MD5 of the compact JSON with forward slashes escaped as \/.

So the two checksums can never match once any value contains a /, which in practice is almost always:

"logo": "shopify://shop_images/logo.png",
"favicon": "shopify://shop_images/favicon.png",
"blocks": { "…": { "type": "shopify://apps/<app>/blocks/<embed>/<uuid>", … } }

Checked against the real file:

Normalization MD5
CLI-style (comment + whitespace stripped) 5b60bb13…
json.dumps(data, separators=(',',':')) 5b60bb13… (same)
same, with / → \/ 02f9aa4c… = Shopify checksumMd5 ✅

Why it loops instead of settling

  1. Something downloads the file once (startup reconciliation, or one save in the theme editor).
  2. The file watcher re-hashes the downloaded file. The hash differs from the remote checksum the CLI just recorded, so the CLI treats it as a local edit and uploads it (update). Shopify accepts it as a no-op; updatedAt doesn't change.
  3. On a slow connection the upload is still in flight when the next poll starts 3 s later. The file is in unsyncedFileKeys, so that poll filters it out of the checksum list.
  4. On the following poll the file is back in the list. Compared with the previous (filtered) list it looks like a new remote file, so it's downloaded again, and we're back at step 2.

With a 3-page checksum listing at ~5 s per request, each poll takes ~20 s, so the cycle repeats every two polls (~45 s).

Steps 1–2 and the checksum table are verified (hashes computed from the real file, behaviour read from the 4.9.4 dist code). Step 3 is my reading of the minified code plus the cycle timing; I haven't stepped through it in a debugger.

Steps to reproduce

  1. Use a theme whose config/settings_data.json contains any string with /, such as a shopify://shop_images/... logo.
  2. Run shopify theme dev --theme-editor-sync.
  3. Change and save any setting in the theme editor once, so the CLI downloads the file.
  4. Watch the terminal: the download / update pair keeps repeating, and 127.0.0.1:9292 keeps reloading.

The loop needs the upload to take longer than the 3 s poll gap. That's easy to hit on a slow connection; elsewhere you may need to throttle the network.

Expected

A download that's byte-identical to the local file shouldn't be re-uploaded or re-downloaded, and the sync should settle after one round.

Possible fixes

  • Normalize slash escaping (or parse and re-serialize the way the server does) when computing the settings_data.json checksum.
  • After writing a downloaded file, don't treat the watcher's change event for that write as a local edit.
  • Don't let a file's in-flight upload drop it from the poll's previous/next checksum lists asymmetrically.

Workaround

shopify theme dev --theme-editor-sync --ignore config/settings_data.json

Related

#4715 ("CLI always requesting reconciliation strategy for settings_data.json", closed as not planned) is very likely the same checksum mismatch showing up at startup: the CLI sees local and remote as different even though git shows no change.

Activity

  1. wangliuyang6666 commented on Nov 5, 2026

    @wangliuyang6666
    Author

    Update: reproduced on 5.0.1 (Node v26.13.0, macOS 26.5.2). The settings_data.json checksum code is unchanged from 4.9.4.

    Run: shopify theme dev --theme-editor-sync --verbose. I edited logo_height locally to trigger a remote change, then reverted it. Each change produced the redundant round: download of a file identical to the one just uploaded, then an update of the same bytes (verified with cmp after the revert round).

    Today the Admin API requests took ~1.7 s instead of ~5 s, so the redundant upload finished before the next poll and the loop stopped after one round each time. That's consistent with step 3 above: the endless loop needs the upload to outlast the 3 s poll gap. The redundant download + upload happens on every remote change regardless.

    Condensed verbose output (GraphQL bodies, headers and store URL removed; ISO timestamps are UTC, • Synced lines are UTC+8):

    2026-11-05T08:57:35.282Z: Reading the content of file at config/settings_data.json...
    2026-11-05T08:57:35.284Z: Sending Admin GraphQL: mutation themeFilesUpsert
    2026-11-05T08:57:37.348Z: Request completed in 2064 ms
    • 16:57:37  Synced » update config/settings_data.json
    2026-11-05T08:57:38.229Z: Sending Admin GraphQL: query getThemeFileChecksums
    …  (polls every ~3 s)
    2026-11-05T08:57:49.519Z: Reading the content of file at config/settings_data.json...
    2026-11-05T08:57:49.520Z: Sending Admin GraphQL: query getThemeFileBodies
    2026-11-05T08:57:51.264Z: Request completed in 1744 ms
    2026-11-05T08:57:51.265Z: Writing some content to file at config/settings_data.json...
    • 16:57:51 Synced » download config/settings_data.json from remote theme
    2026-11-05T08:57:51.521Z: Reading the content of file at config/settings_data.json...
    2026-11-05T08:57:51.522Z: Sending Admin GraphQL: mutation themeFilesUpsert
    2026-11-05T08:57:53.210Z: Request completed in 1688 ms
    • 16:57:53  Synced » update config/settings_data.json
    

    I've also posted this to the Shopify CLI and Libraries category on community.shopify.dev, as the bug-report template asks; that post is waiting for moderator approval.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions