Creating new article with the same content gives errors

Topic summary

A developer is encountering intermittent 422 Unprocessable Entity errors when creating Shopify articles via API, despite using code that previously worked without issues.

Technical Details:

  • Using Go to POST article data to Shopify API
  • Article structure includes: title, author, tags, HTML body, published timestamp, featured image (src/alt), and custom metafields
  • Metafield specifically tracks “feature_image_page_number” as an integer
  • Same content/structure produces inconsistent results: some articles create successfully, others fail with 422 errors

Current Status:

  • Developer has shared complete code and struct definitions
  • Two response screenshots provided showing different error behaviors
  • Root cause remains unidentified
  • Seeking community assistance to diagnose the inconsistent API responses

The issue appears related to data validation or API rate limiting, though the exact trigger for the 422 errors is unclear from identical request payloads.

Summarized with AI on November 23. AI used: claude-sonnet-4-5-20250929.

Hi Following is my code and struct for creating shopify articles. I never had a issue with them until recently where some of the pages get created and others send a 422 Unprocessable Entity response. can someone help me sorting this out as i dont see an issue here..!

pageArticle := &ArticleRequest{
				Article: Article{
					Title:       FinalTitle,
					Author:      "Hit Parader",
					Tags:        Tags,
					BodyHTML:    html,
					PublishedAt: time.Now().UTC().Format("2006-01-02T15:04:05-0700"),
					Image: ArticleImage{
						Src: pageSRC,
						Alt: title,
					},
					Metafields: []ArticleMeta{
						{
							Key:       "feature_image_page_number",
							Value:     page,
							Type:      "number_integer",
							Namespace: "custom",
						},
					},
				},
			}

			spew.Dump(pageArticle)
			articleJSON2, err := json.Marshal(pageArticle)
			if err != nil {
				fmt.Println(err)
			}
			articleReq2, err := http.NewRequest("POST", newArticleQueryFinal, bytes.NewBuffer(articleJSON2))
			if err != nil {
				fmt.Println(err)
			}
			articleReq2.Header.Add("X-Shopify-Access-Token", token)
			articleReq2.Header.Add("Content-Type", "application/json")

			resp3, err := client.Do(articleReq2)
			if err != nil {
				fmt.Println(err)
			}

Struct

type ArticleRequest struct {
	Article Article `json:"article"`
}
type Article struct {
	Title       string        `json:"title"`
	Author      string        `json:"author"`
	Tags        string        `json:"tags"`
	BodyHTML    string        `json:"body_html"`
	PublishedAt string        `json:"published_at"`
	Image       ArticleImage  `json:"image"`
	Metafields  []ArticleMeta `json:"metafields"`
}
type ArticleImage struct {
	Src string `json:"src,omitempty"`
	Alt string `json:"alt,omitempty"`
}
type ArticleMeta struct {
	Key       string `json:"key"`
	Value     int    `json:"value"`
	Type      string `json:"type"`
	Namespace string `json:"namespace"`
}

same kind of content gives 2 response types. Im at a loss here.

Any help would be appreciated..!!!