Jeremy Davis
Jeremy Davis
Sitecore, C# and web development
Article printed from: https://blog.jermdavis.dev/posts/2025/order-and-scs

Order and Sitecore Content Serialisation

A fun mistake that you might not notice until after your PR...

Published 14 July 2025

A common but not-fun issue for working developers is when you do some work, test it locally, submit a PR and then find that it blows up on someone else's computer. I'm not too proud to admit that I had an issue with this recently, which highlights a thing you have to remember when working with Sitecore Content Serialisation.

The issue url copied!

Working on change to a project that used SCS but not following Helix patterns, I'd needed to add two things:

  • A couple of new data templates for some data source items and folders to organise them.
  • The item for the data source folder, with its insert options for creating items and folders.

All fairly trivial you'd think. So I did the work in Sitecore and serialised the items. And everything seemed to be working fine.

But when another developer tried to pull the branch and work on the changes they got an error from the dotnet sitecore ser push command. Something similar to:

A console window showing an error message after trying to run a Sitecore Serialisation push operation

The error message was something similar to:

GraphQL.ExecutionError: [A] /sitecore/content/Home/Example (5ef9541c-f373-47d7-8388-5cac77954d55):
Template ID ba523da9-8ff4-443a-a901-a9adc6c7cf85 did not exist

					

Why it broke url copied!

To cut straight to it, the answer is order.

SCS is fairly literal about how it handles your config for your modules. And with a lot of stuff stripped out from the (rather complex) "main" module file, I'd accidentally written something that boiled down to:

{
    "$schema": "../../.sitecore/schemas/ModuleFile.schema.json",
    "namespace": "bug-demo-site",
    "items": {
      "includes": [
        {
          "name": "content",
          "path": "/sitecore/content/Home/Example"
        },
        {
          "name": "template",
          "path": "/sitecore/templates/User Defined/Example Data Template"
        }
      ]
    }
}

					

The content include was ahead of the template include. So the error is fairly literally saying "I'm trying to install this item, but the template for it doesn't exist in the content tree yet".

And that's confirmed by reversing the two entries above and trying the push again:

{
    "$schema": "../../.sitecore/schemas/ModuleFile.schema.json",
    "namespace": "bug-demo-site",
    "items": {
      "includes": [
        {
          "name": "template",
          "path": "/sitecore/templates/User Defined/Example Data Template"
        },
        {
          "name": "content",
          "path": "/sitecore/content/Home/Example"
        }
      ]
    }
}

					

And that will complete ok - because now the template gets put in place before it tries to insert the content.

So take care when you're adding stuff to your modules - it's entirely possible to confuse the tooling if you don't think about your config properly.

↑ Back to top