Understanding error message - INVALID_VALUE

I am trying to understand this error message. I know “INVALID_VALUE” means that my application sent a value the Square did not expect; however, it seems to be suggesting that the “type” parameter is incorrect (when I think it is correct, comparing it to successful API calls). I tried removing the empty version parameter, which had no effect.

The data sent to the upsert_catalog_object call:

{
  "object":
  {
    "type": "ITEM",
    "id": "6Y33BADCNVPT2BE33NTTOIL3",
    "product_type": "REGULAR",
    "item_data":
    {
      "name": "Testing",
      "description": "Testing",
      "abbreviation": "Testing",
      "available_online": true,
      "available_for_pickup": true,
      "category_id": "I3PO3ELB4Z6UMQ47R2YE4FLS",
      "variations":
      [
        {
          "id": "#child387",
          "type": "ITEM_VARIATION",
          "present_at_locations_ids": [],
          "item_variation_data":
          {
            "name": "Testing",
            "price_money": {"amount": 10000, "currency": "USD"},
            "pricing_type": "FIXED_PRICING",
            "sku": "327",
            "stockable": true,
            "track_inventory": true,
            "upc": ""
          },
          "version": null
        }
      ]
    },
    "version": 1629385868350
  },
  "idempotency_key": "61c4262bc28a4be88c43effe6dc1d8e2"
}

The response:

[
  {
    "category": "INVALID_REQUEST_ERROR", 
    "code": "INVALID_VALUE", 
    "detail": "Invalid object: Invalid Object with Id: 6Y33BADCNVPT2BE33NTTOIL3\n[merchant_token=<token>] Updated object 6Y33BADCNVPT2BE33NTTOIL3 has incorrect type 1 (5 expected)."
  }
]

Using the Python SDK.

The request was trying to upsert an existing object 6Y33BADCNVPT2BE33NTTOIL3 , but it changed the type field from ITEM_VARIATION to ITEM . Changing the type of an existing object isn’t allowed. The error message is definitely bad and our team is going to make the necessary adjustments. :slightly_smiling_face:

Ah, that makes more sense. Thank you!