After newly creating a content type via JSOM, I'm getting the following error when calling contentType.update() or context.load(contentType):

The object is not associated with an object identity or the object identity is invalid.

Can you explain what this means, and how to avoid it?

I know (by inspecting the source of sp.js) this is happening because contentType.get_path().$d_0 is false, but I don't know what that means, or how to make it true again.

// excerpt from SP.ClientQueryInternal, where the error is thrown
// a is the content type in this case
if (!a.get_path() || !a.get_path().$d_0)
    throw Error.create(SP.ResResources.getString("NoObjectPathAssociatedWithObject"));

However, I've tracked when that value becomes false.

Here's how I'm creating the content type. This is where the $d_0 property becomes false.

// Create the content type
ctInfo = new SP.ContentTypeCreationInformation()
// Set up the info
// ...
contentType = contentTypes.add(ctInfo);
context.load(contentType) // This works, although it is superfluous
// contentType.get_path().$d_0 is true at this point
context.executeQueryAsync(successHandler, failureHandler)
// contentType.get_path().$d_0 is now false; this is before the success handler is called!
context.load(contentType)   // Fails here (although it is superfluous at this point)

After successHandler returns, $d_0 is still false, and contentType.update() or context.load(contentType) still fails (e.g. while trying to add site columns to contentType.

  • What is your "contentTypes"? Is it a "contentTypeCollection"? You just need to load the collection "contentTypes". No need of contentType.update() and context.load(contentType). Sep 12, 2017 at 18:29
  • Yes, it is. I'm actually trying to update the contentType after adding site columns to it, but I've removed that piece to narrow down the scope of the bug.
    – jpaugh
    Sep 12, 2017 at 18:33
  • Are you trying to get the newly created content type? Sep 12, 2017 at 18:33
  • No, I'm not calling getByTitle or such. I've been using the reference returned by contentTypes.add. This has worked in the past, and I'm not sure what's different now.
    – jpaugh
    Sep 12, 2017 at 18:35
  • why have you loaded context.load(contentType) twice? and then executed? Update your code please. Sep 12, 2017 at 18:40

1 Answer 1


I figured out the problem. There was a problem with the way I was created the content type, but that error was swallowed. SharePoint did actually return an error message for the original issue, aside from this obscure error message:

Invalid request.

Unfortunately, the issue wasn't in the abbreviated code I posted. I was setting the parentContentType property of the ctInfo object to an empty array [], which is definitely an invalid content type!

I should have caught this, of course, but my success handler was being called anyway, due to another issue; and I am re-using the same failure-handler for many requests, making it even harder to pin down where "Invalid Request" was coming from.

Here is the line in the request (to create the content-type) which was incorrect:

<Property Name="ParentContentType" Type="Array"/>

Here is the entire request which was generated to create the content type.

<?xml version="1.0"?>
<Request xmlns="http://schemas.microsoft.com/sharepoint/clientquery/2009" SchemaVersion="" LibraryVersion="" ApplicationName="Javascript Library">
    <ObjectPath Id="288" ObjectPathId="287"/>
    <ObjectIdentityQuery Id="289" ObjectPathId="287"/>
    <Query Id="290" ObjectPathId="267">
      <Query SelectAllProperties="true">
      <ChildItemQuery SelectAllProperties="true">
    <Property Id="267" ParentId="38" Name="ContentTypes"/>
    <Method Id="287" ParentId="267" Name="Add">
        <Parameter TypeId="{168f3091-4554-4f14-8866-b20d48e45b54}">
          <Property Name="Description" Type="String">IPAC Program Proprosal</Property>
          <Property Name="Group" Type="String">IPAC</Property>
          <Property Name="Id" Type="Null"/>
          <Property Name="Name" Type="String">IpacProprosal</Property>
          <Property Name="ParentContentType" Type="Array"/>
    <Identity Id="38" Name="740c6a0b-85e2-48a0-a494-e0f1759d4aa7:site:4b2682a6-2589-4acd-a6b4-37538cf731bd:web:7eeee2d4-e551-44a0-aa71-b045b67c9e87"/>

Here is SharePoint's response:

"ErrorMessage":"Invalid request.","ErrorValue":null,"TraceCorrelationId":"a2a5189e-834c-20bc-026e-db3059cb3269","ErrorCode":-1,"ErrorTypeName":"Microsoft.SharePoint.Client.InvalidClientQueryException"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.