# Errors

The error format and every error code the API returns, with its status and what to do.

Source: https://clonelyapp.com/api/errors/


## Error format

Every error has the same shape:

```json
{
  "error": {
    "code": "copy_running",
    "message": "A copy of this source into the same collection is still running. Wait for it to finish, or cancel it first.",
    "copyId": "cmx2zsul80000mn1va6so6jbt"
  }
}
```

| Field | |
|---|---|
| `code` | Stable. Branch on this. |
| `message` | What went wrong and what to do, written for people. The wording can change, so don't parse it. |
| `issues` | Only for `invalid_request`: each field that was refused, as `{ "path", "message" }`. `(body)` means the whole body. |
| `copyId` | Only for `copy_running`: the copy that is still running. |

A request that fails validation lists each problem:

```json
{
  "error": {
    "code": "invalid_request",
    "message": "The request was refused: kind: Invalid option: expected one of \"collection\"|\"store\"; options: Unrecognized key: \"publsh\"",
    "issues": [
      { "path": "kind", "message": "Invalid option: expected one of \"collection\"|\"store\"" },
      { "path": "options", "message": "Unrecognized key: \"publsh\"" }
    ]
  }
}
```

## Error codes

| Code | Status | Meaning |
|---|---|---|
| `unauthorized` | 401 | No API key, or the key is malformed, unknown or revoked. |
| `invalid_request` | 400 | The body or query failed validation. `issues` names each field. |
| `invalid_source` | 400 | The source URL can't be used: it isn't a Shopify store, it is the wrong kind of URL, or the source is empty, a page, blocked or behind a login. |
| `password_required` | 400 | The source store is password protected. Send `sourcePassword`. |
| `password_wrong` | 400 | `sourcePassword` didn't open the store, or too many wrong passwords were tried. |
| `collection_failed` | 400 | Shopify refused to create the new destination collection. The message has its reason. |
| `not_found` | 404 | No copy with this ID in your store, or no endpoint at this path. |
| `not_cancellable` | 409 | The copy is `COMPLETED` or `FAILED`. Cancelling a `CANCELLED` copy returns `200`. |
| `copy_running` | 409 | A copy of this source into the same collection is `PENDING` or `IN_PROGRESS`. `copyId` names it. |
| `product_exists` | 409 | Single product: a product with this handle or SKU is in your store, and the options skip it. The message says which option updates it. |
| `not_copied` | 409 | Single product: the matching product wasn't copied by Clonely, and `updateMatch` is `copied`. |
| `variant_limit` | 400 | Single product: your store hit Shopify's daily variant creation limit. Try again tomorrow. |
| `copy_failed` | 400 | Single product: Shopify refused the product. The message may say why. |
| `reconnect_required` | 409 | Clonely has no working access to your store. Open Clonely in the Shopify admin once. |
| `rate_limited` | 429 | More than 60 requests in a minute with this key. Wait `Retry-After` seconds. |
| `shopify_unavailable` | 503 | The Shopify Admin API didn't answer after retries. Nothing was changed. Wait `Retry-After` seconds. |
| `internal` | 500 | A bug in Clonely. Retrying may work. If it keeps happening, [tell us](https://clonelyapp.com/contact/). |

## Which errors to retry

`rate_limited` and `shopify_unavailable` are safe to retry after the `Retry-After` header's seconds. `internal` may work on a second try. The rest won't change until you change the request or the store, so retrying them is pointless.

For a store on Shopify's daily variant limit, see [Daily variant creation limit reached](https://clonelyapp.com/help-center/daily-variant-creation-limit-reached/).

