metaobjectUpsert mutation fails with INTERNAL_SERVER_ERROR after app reinstallation

Hi everyone :waving_hand:

I’m encountering an issue where the metaobjectUpsert mutation consistently fails with an INTERNAL_SERVER_ERROR immediately after reinstalling app — even though the metaobject definition is successfully recreated during the reinstall process.


:puzzle_piece: Mutation Used

mutation metaobjectUpsert($handle: MetaobjectHandleInput!, $metaobject: MetaobjectUpsertInput!) {
  metaobjectUpsert(handle: $handle, metaobject: $metaobject) {
    metaobject {
      id
      handle
      type
    }
    userErrors {
      field
      message
      code
    }
  }
}



:warning: Error Response

{
  "errors": [
    {
      "message": "Internal error. Looks like something went wrong on our end.\nRequest ID: xxxx-xxx-xxxx (include this in support requests).",
      "extensions": {
        "requestId": "xxxx-xxx-xxxx",
        "code": "INTERNAL_SERVER_ERROR"
      }
    }
  ],
  "data": null
}



:white_check_mark: What I’ve Checked

  • The app is reinstalled and reauthorized successfully.

  • The $app:definition_key metaobject definition is recreated during reinstall.

  • All required scopes (write_metaobjects, etc.) are granted.

  • The mutation works perfectly before uninstalling the app.

  • Other GraphQL mutations work fine after reinstall.


:light_bulb: My Observation

Even after recreating the $app: metaobject definition, running metaobjectUpsert using the same handle (for example, shop-settings) immediately returns an INTERNAL_SERVER_ERROR.

It looks like Shopify might be treating the old handle as stale or invalid due to internal reference cleanup that happens when the app is uninstalled.


:red_question_mark: Questions

  • Does metaobjectUpsert block reuse of handles that existed before reinstall, even if the definition has been recreated?

  • Could this be a timing issue — i.e., the definition needs to propagate before the handle can be reused?

  • Are there known workarounds for handling the same $app: handle after reinstall (like explicitly deleting old instances before re-creating)?


Any guidance or similar experiences would be greatly appreciated! :folded_hands:

Hi @Ravindra_Patel

Could you share that Request ID so we can see what might be causing this?

Yes @Liam-Shopify

Please find below:

  • requestId: "e63fe912-6611-41d3-aa5b-f14e33140be8-1763026312"

  • requestId: "74563687-5c5f-4f5e-bbae-158dcd6d636f-1763036907"