> Documentation index: [Saleor](/llms.txt) · [This section](/developer/llms.txt)
> Source: https://docs.saleor.io/developer/checkout/problems

# Problems

During processing checkout, some problems might occur. Some of them would need to be solved before placing the order. Saleor aggregates existing checkout problems:

-   Field [CheckoutLine.problems](/api-reference/checkout/objects/checkout-line.md#problems) returns a list of problems related to a specific [CheckoutLine](/api-reference/checkout/objects/checkout-line.md).
-   Field [Checkout.problems](/api-reference/checkout/objects/checkout.md#problems) returns a list of all problems related to the checkout and [CheckoutLine.problems](/api-reference/checkout/objects/checkout-line.md#problems) from all checkout's lines.

Each `problem` may require different actions from the customer.

info

Not all potential problems are already ported to `problems` field. See the list below. The list of supported `problems` will be extended in future releases.

<a id="checkoutproblems"></a>

## Checkout.problems

[Checkout.problems](/api-reference/checkout/objects/checkout.md#problems) contains the list of all problems that occurred for the checkout. It also includes the problems that are related to specific lines.

The example below shows query that fetches a [Checkout.problems](/api-reference/checkout/objects/checkout.md#problems).

```graphql
query checkout($id: ID) {
  checkout(id: $id) {
    id
    problems {
      __typename
      ... on CheckoutLineProblemInsufficientStock {
        availableQuantity
        variant {
          id
        }
        line {
          id
        }
      }
      ... on CheckoutLineProblemVariantNotAvailable {
        line {
          id
        }
      }
      ... on CheckoutProblemDeliveryMethodStale {
      delivery {
        id
        shippingMethod {
          id
          name
        }
      }
    }
    ... on CheckoutProblemDeliveryMethodInvalid {
      delivery {
        id
        shippingMethod {
          id
          name
        }
      }
    }
    }
  }
}
```

<a id="checkoutlineproblems"></a>

## CheckoutLine.problems

[CheckoutLine.problems](/api-reference/checkout/objects/checkout-line.md#problems) contains the list of problems that are strictly related to the specific checkout line. The list of problems will be also attached to [Checkout.problems](/api-reference/checkout/objects/checkout.md#problems) field.

The example below shows query that fetches a [CheckoutLine.problems](/api-reference/checkout/objects/checkout-line.md#problems).

```graphql
query checkout($id: ID) {
  checkout(id: $id) {
    id
    lines {
      id
      problems {
        __typename
        ... on CheckoutLineProblemInsufficientStock {
          availableQuantity
          variant {
            id
          }
          line {
            id
          }
        }
        ... on CheckoutLineProblemVariantNotAvailable {
          line {
            id
          }
        }
      }
    }
  }
}
```

<a id="problem-types"></a>

## Problem types

<a id="checkoutlineprobleminsufficientstock"></a>

### CheckoutLineProblemInsufficientStock

[CheckoutLineProblemInsufficientStock](/api-reference/checkout/objects/checkout-line-problem-insufficient-stock.md) - defines the problem where there is not enough stock for the [quantity](/api-reference/checkout/objects/checkout-line.md#quantity) assigned to [CheckoutLine](/api-reference/checkout/objects/checkout-line.md). Until resolving the problem, placing the order will not be possible. Mutation for finalizing the checkout like [checkoutComplete](/api-reference/checkout/mutations/checkout-complete.md) will return an error [INSUFFICIENT\_STOCK](/api-reference/checkout/enums/checkout-error-code.md#insufficient-stock). The quantity should be reduced to the value that is less or equal to [CheckoutLineProblemInsufficientStock.availableQuantity](/api-reference/checkout/objects/checkout-line-problem-insufficient-stock.md#available-quantity).

```graphql
query checkout($id: ID) {
  checkout(id: $id) {
    id
    problems {
      __typename
      ... on CheckoutLineProblemInsufficientStock {
        availableQuantity
        variant {
          id
        }
        line {
          id
        }
      }
    }
    lines {
      id
      problems {
        __typename
        ... on CheckoutLineProblemInsufficientStock {
          availableQuantity
          variant {
            id
          }
          line {
            id
          }
        }
      }
    }
  }
}
```

<a id="checkoutlineproblemvariantnotavailable"></a>

### CheckoutLineProblemVariantNotAvailable

[CheckoutLineProblemVariantNotAvailable](/api-reference/checkout/objects/checkout-line-problem-variant-not-available.md) - defines the problem where the attached [variant](/api-reference/checkout/objects/checkout-line.md#variant) to [CheckoutLine](/api-reference/checkout/objects/checkout-line.md) is not available for purchase. Until resolving the problem, placing the order will not be possible. Mutation for finalizing the checkout like [checkoutComplete](/api-reference/checkout/mutations/checkout-complete.md) will return one of the errors: [PRODUCT\_NOT\_PUBLISHED](/api-reference/checkout/enums/checkout-error-code.md#product-not-published), [PRODUCT\_UNAVAILABLE\_FOR\_PURCHASE](/api-reference/checkout/enums/checkout-error-code.md#product-unavailable-for-purchase), [UNAVAILABLE\_VARIANT\_IN\_CHANNEL](/api-reference/checkout/enums/checkout-error-code.md#unavailable-variant-in-channel).

```graphql
query checkout($id: ID) {
  checkout(id: $id) {
    id
    problems {
      __typename
      ... on CheckoutLineProblemInsufficientStock {
        availableQuantity
        variant {
          id
        }
        line {
          id
        }
      }
      ... on CheckoutLineProblemVariantNotAvailable {
        line {
          id
        }
      }
    }
    lines {
      id
      problems {
        __typename
        ... on CheckoutLineProblemInsufficientStock {
          availableQuantity
          variant {
            id
          }
          line {
            id
          }
        }
        ... on CheckoutLineProblemVariantNotAvailable {
          line {
            id
          }
        }
      }
    }
  }
}
```

<a id="checkoutproblemdeliverymethodstale"></a>

### CheckoutProblemDeliveryMethodStale

**Added in Saleor 3.23.**

[CheckoutProblemDeliveryMethodStale](/api-reference/checkout/objects/checkout-problem-delivery-method-stale.md) - indicates that the assigned delivery method's pricing or availability may be outdated. This happens after changes that affect shipping (e.g. voucher applied, shipping address updated, line quantity changed). The method is still assigned but has not been re-validated.

To solve, call [`deliveryOptionsCalculate`](/api-reference/shipping/mutations/delivery-options-calculate.md). If the method is still valid, the problem clears. If the method is no longer available, the problem becomes `CheckoutProblemDeliveryMethodInvalid`.

info

This problem does not block checkout completion but when `CheckoutProblemDeliveryMethodStale` is present while calling `checkoutComplete` mutation, Saleor will implicitly validate the delivery. If assigned delivery is invalid, checkout complete will return an error.

<a id="checkoutproblemdeliverymethodinvalid"></a>

### CheckoutProblemDeliveryMethodInvalid

**Added in Saleor 3.23.**

[CheckoutProblemDeliveryMethodInvalid](/api-reference/checkout/objects/checkout-problem-delivery-method-invalid.md) - indicates that the assigned delivery method is no longer applicable (e.g. it was deleted, or it no longer ships to the checkout address).

To solve, call [`deliveryOptionsCalculate`](/api-reference/shipping/mutations/delivery-options-calculate.md) to get a list of available methods, then call [`checkoutDeliveryMethodUpdate`](/api-reference/checkout/mutations/checkout-delivery-method-update.md) with a valid method ID.

info

This problem blocks checkout completion. [`checkoutComplete`](/api-reference/checkout/mutations/checkout-complete.md) will return an error until a valid delivery method is selected.

<a id="control-error-flow"></a>

## Control error flow

In the current way of error handling, some mutations can raise an error that is not related to the requested action. For example, [checkoutShippingAddressUpdate](/api-reference/checkout/mutations/checkout-shipping-address-update.md) can raise [INSUFFICIENT\_STOCK](/api-reference/checkout/enums/checkout-error-code.md#insufficient-stock) error. It is raised as some of the [ProductVariant](/api-reference/products/objects/product-variant.md)s attached to Checkout don't have enough stock to finalize the checkout process. By changing the value of the flag [useLegacyErrorFlow](/api-reference/miscellaneous/objects/checkout-settings.md#use-legacy-error-flow) to `false`, the errors unrelated to specific actions will not be raised (as in the above example: mutation [checkoutShippingAddressUpdate](/api-reference/checkout/mutations/checkout-shipping-address-update.md) was raising [INSUFFICIENT\_STOCK](/api-reference/checkout/enums/checkout-error-code.md#insufficient-stock) error). Instead, the new problem will be listed as [Checkout.problems](/api-reference/checkout/objects/checkout.md#problems) and [CheckoutLine.problems](/api-reference/checkout/objects/checkout-line.md#problems) (if the problem is related to the [CheckoutLine](/api-reference/checkout/objects/checkout-line.md)).

caution

Not all potential problems are already ported to the `problems` field. See the list above. It means that even by switching [useLegacyErrorFlow](/api-reference/miscellaneous/objects/checkout-settings.md#use-legacy-error-flow) to `false`, some mutations can raise the error unrelated to the requested action. The list of supported `problems` will be extended in future releases.

note

The flag [useLegacyErrorFlow](/api-reference/miscellaneous/objects/checkout-settings.md#use-legacy-error-flow) can be modified by updating the [checkoutSettings](/api-reference/channels/inputs/channel-update-input.md#checkout-settings) via [channelUpdate](/api-reference/channels/mutations/channel-update.md) mutation.

The flag [useLegacyErrorFlow](/api-reference/miscellaneous/objects/checkout-settings.md#use-legacy-error-flow) can be also changed via Saleor-dashboard side.
