Got "Invalid fulfillment order line item quantity requested." in fulfillmentCreateV2 mutation

I got an invalid error when I use fulfillmentCreateV2 mutation.

Mutation:

mutation fulfillmentCreateV2($fulfillment: FulfillmentV2Input!) {
  fulfillmentCreateV2(fulfillment: $fulfillment) {
    fulfillment {
      id
    }
    userErrors {
      field
      message
    }
  }
}

Query variables:

{
  "fulfillment": {
    "lineItemsByFulfillmentOrder": [
      {
        "fulfillmentOrderId": "gid://shopify/FulfillmentOrder/12345",
        "fulfillmentOrderLineItems": [
          {
            "id": "gid://shopify/FulfillmentOrderLineItem/12345",
            "quantity": 1
          }
        ]
      }
    ]
  }
}

Response:

{
  "data": {
    "fulfillmentCreateV2": {
      "fulfillment": null,
      "userErrors": [
        {
          "field": [
            "fulfillment"
          ],
          "message": "Invalid fulfillment order line item quantity requested."
        }
      ]
    }
  },
  "extensions": {
    "cost": {
      "requestedQueryCost": 10,
      "actualQueryCost": 10,
      "throttleStatus": {
        "maximumAvailable": 2000,
        "currentlyAvailable": 1990,
        "restoreRate": 100
      }
    }
  }
}

I confirmed the order id, the line item id, and the quantity are correct. Does anyone have any solutions?

What does

gid://shopify/FulfillmentOrder/12345

look like? Can you echo the status of the fulfillment order and its line items here? The API seems to be complaining that this fulfillment order does not have enough quantity for the line item. Maybe the FulfillmentOrder was already fulfilled and the status might be IN_PROGRESS or CLOSED.

2 Likes

Oh, you are right. That line item is fulfilled. Thank you!