# getErrors

> This document is the Markdown version of [formisch.dev/methods/api/getErrors/](https://formisch.dev/methods/api/getErrors/). For the complete documentation index, see [llms.txt](https://formisch.dev/llms.txt).

Retrieves error messages from the form. When called without a config, returns form-level errors. When called with a path, returns errors for that specific field.

```ts
const errors = getErrors<TSchema>(form);
const errors = getErrors<TSchema, TFieldPath>(form, config);
```

## Generics

- `TSchema` `extends FormSchema`
- `TFieldPath` `extends RequiredPath | undefined = undefined`

## Parameters

- `form` `BaseFormStore<TSchema>`
- `config` `GetFormErrorsConfig | GetFieldErrorsConfig<TSchema, TFieldPath> | undefined`

### Explanation

The `form` parameter is the form store to retrieve errors from. The optional `config` parameter specifies which errors to retrieve - either form-level errors (when omitted) or field-specific errors (when a `path` is provided).

## Returns

- `result` `[string, ...string[]] | null`

## Related

### Primitives

[`useForm`](/react/api/useForm.md)

### Methods

[`getDeepErrors`](/methods/api/getDeepErrors.md), [`setErrors`](/methods/api/setErrors.md), [`validate`](/methods/api/validate.md)
