GraphQL: Instance is not unique

Hi there!
I’m using this query to add a document:

mutation CreateOrganization {
  createOrganization(data: {					
    organizationType: CLIENT_ORGANIZATION,
    name: "Candy Co",
    description: "Making the world a better place",
    defaultLanguage: "en",
    defaultTimezone: "America/New_York",
    provider: {
      connect: "284109474703081989"
    },
  }) {
    _id
  }
}

I’m getting this error:

{
    "errors": [
        {
            "message": "Instance is not unique.",
            "extensions": {
                "code": "instance not unique"
            }
         }
    ]    
}

Here is my schema for the Organization Type:

type Organization @collection(name: "organizations") {
    organizationType: OrganizationType!
    name: String!
    description: String
    logo: String
    defaultLanguage: String
    defaultTimezone: String
    availableLabels: [String]
    availableFocusAreas: [FocusArea!]
    # ClientOrganization or CoachOrganization
    provider: Organization
    # ClientOrganization
    clients: [User!] @relation(name: "organization_clients")
    availableCoaches: [User!] @relation(name: "organization_available_coaches")
    # CoachOrganization
    coaches: [User!] @relation(name: "organization_coaches")
    # ProviderOrganization
    providerOrgUsers: [User!] @relation(name: "user_providerOrganization")
}

As you can see, there are no uniqueness constraints on any of the fields.

Any help with getting this issue resolved would be greatly appreciated.

Thanks in advance :slight_smile:

Look at your indexes. Perhaps you have created a custom index that enforces a constraint outside of the GraphQL import?

This can’t be it, since I have no custom indexes.
However, I’ve found out that this error only occurs when I “connect” to another organization through the provider field in the query…

Thanks, this was the issue after all :smile:
I had an index named organization_provider_by_organization , which had a uniqueness constraint.