Duplicate Theme App Extension Scripts Loading (Ghost Extension + 404)

Hi everyone,

I’m running into a pretty deep issue with duplicate theme app extension scripts loading on a Shopify storefront, and I’d really appreciate any insights from others who’ve dealt with similar behavior.


Context

  • App: MyApp (single app installed)

  • Theme app embed: only one enabled

  • ScriptTag API: no scripts registered


The Problem

Two different MyApp extension bundles are loading simultaneously on the storefront:

  • Old extension (ghost)

  • UUID: 629bfe91-...

  • Slug: myapp-beta-23

  • New extension (current)

  • UUID: 019ce709-...

  • Slug: myapp-245

Additionally:

  • A request to:

cdn.myapp.com/latest/sdks/myapp-main.js

returns 404 Not Found (file no longer exists — renamed in newer builds)


What’s Strange

1. Only ONE app embed exists

Checked config/settings_data.json:

  • Only one MyApp embed block

  • No reference to old UUID

  • Block is enabled

So this is not a duplicate embed block issue in theme settings.


2. No ScriptTag API usage

Confirmed:

  • No scripts registered via ScriptTag API

  • No dynamic injection from app backend


3. Storefront HTML shows TWO injection zones

Old injection (legacy pattern)


<script type="load" d-src="...myapp-beta-23..."></script>

New injection (standard pattern)


<script src="...myapp-245..." defer></script>

Key observations:

  • Old script has no BEGIN app block wrapper → appears orphaned

  • Uses legacy type="load" + d-src

  • New script is properly wrapped and tied to theme settings


4. This is NOT isolated to one app

Other apps (including Shopify Inbox) show the same pattern:

  • Old UUID (legacy zone)

  • New UUID (modern zone)

So this looks like a platform-level artifact, not app-specific.


Root Cause (Hypothesis)

1. Shopify extension registration migration issue

It looks like:

  • Old extension registrations (v4 UUIDs) were not cleaned up

  • New registrations (v7 UUIDs) were created during migration

  • Both are now injected via content_for_header

Result: ghost extension still loads despite no config reference


2. App rename bug (confirmed in community)

There’s an existing thread about this:

Renaming an app can duplicate embed blocks / registrations

Uninstalling doesn’t remove old instances

This aligns with:

  • Old slug: myapp-beta

  • Current app: myapp


3. 404 error cause

Old extension still references:


myapp-main.js

But this file was renamed to:


myapp-shopify-main.js

→ hence the 404


What I’ve Ruled Out

  • Duplicate theme app embeds → NO

  • ScriptTag API injection → NO

  • Multiple apps installed → NO

  • Codebase referencing old UUID → NO


Current Workaround

Adding a global mutex in the loader:


if (window.__myappMainLoading) return;

window.__myappMainLoading = true;

This prevents double execution but does not remove the ghost injection.


Questions

  1. Has anyone else seen orphaned extension scripts like this (no app block wrapper)?

  2. Is there any way to:

  • Remove stale extension UUIDs from Shopify’s injection pipeline?

  • Force a cleanup of content_for_header registrations?

  1. Is this a known Shopify migration bug with:
  • UUID changes (v4 → v7)?

  • App renames?

  1. Has anyone successfully resolved this via Shopify Support?

What I’m Considering Next

  • Raising a Shopify Partner Support ticket with:

  • HTML evidence of orphaned script

  • UUID mismatch

  • Cross-app duplication (Inbox also affected)


TL;DR

Even with:

  • One app

  • One embed block

  • No ScriptTags

→ Shopify is injecting two extension scripts (one ghost, one current)

Likely due to:

  • Old extension registration not being cleaned up

  • App rename / platform migration artifact


Would really appreciate if anyone has encountered this or found a clean fix beyond defensive coding.

Thanks in advance!