---
title: MetafieldsSetUserError - Storefront API
description: An error that occurs during the execution of `MetafieldsSet`.
api_version: 2026-04
api_name: storefront
type: object
api_type: graphql
source_url:
  html: >-
    https://shopify.dev/docs/api/storefront/latest/objects/MetafieldsSetUserError
  md: >-
    https://shopify.dev/docs/api/storefront/latest/objects/MetafieldsSetUserError.md
---

# Metafields​Set​User​Error

object

An error that occurs during the execution of `MetafieldsSet`.

## Fields

* code

  [Metafields​Set​User​Error​Code](https://shopify.dev/docs/api/storefront/latest/enums/MetafieldsSetUserErrorCode)

  The error code.

* element​Index

  [Int](https://shopify.dev/docs/api/storefront/latest/scalars/Int)

  The index of the array element that's causing the error.

* field

  [\[String!\]](https://shopify.dev/docs/api/storefront/latest/scalars/String)

  The path to the input field that caused the error.

* message

  [String!](https://shopify.dev/docs/api/storefront/latest/scalars/String)

  non-null

  The error message.

***

## Map

No referencing types

***

## Mutations

* [cart​Metafields​Set](https://shopify.dev/docs/api/storefront/latest/mutations/cartMetafieldsSet)

  mutation

  Sets [`Metafield`](https://shopify.dev/docs/api/storefront/2026-04/objects/Metafield) values on a cart, creating new metafields or updating existing ones. Accepts up to 25 metafields per request.

  Cart metafields can automatically copy to order metafields when an order is created, if there's a matching order metafield definition with the [cart to order copyable](https://shopify.dev/docs/apps/build/metafields/use-metafield-capabilities#cart-to-order-copyable) capability enabled.

  ***

  **Note:** This mutation doesn\&#39;t trigger \<a href="https://shopify.dev/docs/api/functions">Shopify Functions\</a>. Changes aren\&#39;t available to Shopify Functions until the buyer goes to checkout or performs another cart interaction that triggers the functions.

  ***

  * metafields

    [\[Cart​Metafields​Set​Input!\]!](https://shopify.dev/docs/api/storefront/latest/input-objects/CartMetafieldsSetInput)

    required

    ### Arguments

    The list of Cart metafield values to set. Maximum of 25.

    The input must not contain more than `250` values.

  ***

***

## MetafieldsSetUserError Mutations

### Mutated by

* [cart​Metafields​Set](https://shopify.dev/docs/api/storefront/latest/mutations/cartMetafieldsSet)

***

## Interfaces

* [Displayable​Error](https://shopify.dev/docs/api/storefront/latest/interfaces/DisplayableError)

  interface

***

## MetafieldsSetUserError Implements

### Implements

* [Displayable​Error](https://shopify.dev/docs/api/storefront/latest/interfaces/DisplayableError)
