# Errors

The `Errors` type is used to access the errors that occurred during the last API request when building custom sign-in and sign-up flows.

```ts
interface Errors<T> {
  fields: T
  raw: ClerkError[] | null
  global: ClerkGlobalHookError[] | null
}
```

## Properties

| Name   | Type                         | Description                                                                                                                                                                                                                                                               |
| ------ | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| fields | SignInFields | SignUpFields | The collection of possible errors on known fields.                                                                                                                                                                                                                        |
| raw    | ClerkError[] | null        | The raw, unparsed errors from the Clerk API. For example, if the error is an instance of ClerkAPIResponseError, this field will contain the ClerkAPIResponseError instance, while fields will contain the parsed errors associated with the fields that caused the error. |
| global | ClerkGlobalHookError | null | Parsed errors that are not related to any specific field.                                                                                                                                                                                                                 |

### `SignInFields`

| Name       | Type               | Description                         |
| ---------- | ------------------ | ----------------------------------- |
| identifier | FieldError | null | The error for the identifier field. |
| password   | FieldError | null | The error for the password field.   |
| code       | FieldError | null | The error for the code field.       |

### `SignUpFields`

| Name          | Type               | Description                             |
| ------------- | ------------------ | --------------------------------------- |
| firstName     | FieldError | null | The error for the first name field.     |
| lastName      | FieldError | null | The error for the last name field.      |
| emailAddress  | FieldError | null | The error for the email address field.  |
| phoneNumber   | FieldError | null | The error for the phone number field.   |
| password      | FieldError | null | The error for the password field.       |
| username      | FieldError | null | The error for the username field.       |
| code          | FieldError | null | The error for the code field.           |
| captcha       | FieldError | null | The error for the captcha field.        |
| legalAccepted | FieldError | null | The error for the legal accepted field. |

### `FieldError`

| Name         | Type   | Description                                                     |
| ------------ | ------ | --------------------------------------------------------------- |
| code         | string | The error code of the error, returned by the Clerk API.         |
| message      | string | The error message of the error, returned by the Clerk API.      |
| longMessage? | string | The long error message of the error, returned by the Clerk API. |

### `ClerkGlobalHookError`

Represents an error that occurred during the last API request, but is not related to any specific field. Is an instance of a `ClerkError`, and can also be an instance of a superclass of `ClerkError`, such as [ClerkAPIResponseError](https://clerk.com/docs/tanstack-react-start/reference/types/clerk-api-response-error.md) or `ClerkRuntimeError`.

| Name                    | Type          | Description                                                                                                                                                  |
| ----------------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| isClerkApiResponseError | () => boolean | A function that returns true if the error is an instance of ClerkAPIResponseError, false otherwise. Will also narrow down the type to ClerkAPIResponseError. |
| isClerkRuntimeError     | () => boolean | A function that returns true if the error is an instance of ClerkRuntimeError, false otherwise. Will also narrow down the type to ClerkRuntimeError.         |

### `ClerkError`

Type used for all errors generated by the Clerk SDK.

| Name         | Type   | Description                                                                                                                                                                                                                                   |
| ------------ | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| message      | string | A message that describes the error. This is typically intented to be showed to the developers. It should not be shown to the user or parsed directly as the message contents are not guaranteed to be stable - use the code property instead. |
| code         | string | A machine-stable code that identifies the error.                                                                                                                                                                                              |
| longMessage? | string | A user-friendly message that describes the error and can be displayed to the user. This message defaults to English but can be usually translated to the user's language by matching the code property to a localized message.                |
| cause?       | Error  | The cause of the error, typically an Error instance that was caught and wrapped by the Clerk error handler.                                                                                                                                   |
| docsUrl?     | string | A URL to the documentation for the error.                                                                                                                                                                                                     |

---

## Sitemap

[Overview of all docs pages](https://clerk.com/docs/llms.txt)
