bulkOperationRunMutation error: "You must use an allowed mutation name."

I want to run this GraphQL query to bulk upload metafields:

mutation {
  bulkOperationRunMutation(
    mutation: """
    mutation call($definition: MetafieldDefinitionInput!) {
      metafieldDefinitionCreate(definition: $definition) {
        createdDefinition {
          key
          namespace
          ownerType
        }
        userErrors {
          field
          message
          code
        }
      }
    }
    """,
    stagedUploadPath: "stagedUploadPath"
  ) {
    bulkOperation {
      id
      url
      status
    }
    userErrors {
      message
      field
    }
  }
}

But I’m getting this error:

{
    "data": {
        "bulkOperationRunMutation": {
            "bulkOperation": null,
            "userErrors": [
                {
                    "message": "You must use an allowed mutation name.",
                    "field": [
                        "mutation"
                    ]
                }
            ]
        }
    },
    "extensions": {
        "cost": {
            "requestedQueryCost": 10,
            "actualQueryCost": 10,
            "throttleStatus": {
                "maximumAvailable": 2000.0,
                "currentlyAvailable": 1990,
                "restoreRate": 100.0
            }
        }
    }
}

How can I solve this error?

Hi Shanjidhasan

It looks like the metafieldDefinitionCreate is not one of the supported mutations that are accepted by bulkOperationRunMutation (see our docs here). You’ll need to create these metafield definitions individually.