# getDeepErrorEntry

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

Retrieves the errors of the first erroring field of a specific field or the entire form as an entry pairing the path to the field with its error messages, by walking through the field store and all its descendants and stopping at the first field with errors. This is useful for locating the first erroring descendant of a field whose value is a nested structure while retaining all errors at that path.

```ts
const entry = getDeepErrorEntry<TSchema>(form);
const entry = getDeepErrorEntry<TSchema, TFieldPath>(form, config);
```

## Generics

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

## Parameters

- `form` `BaseFormStore<TSchema>`
- `config` `GetFormDeepErrorEntryConfig | GetFieldDeepErrorEntryConfig<TSchema, TFieldPath> | undefined`

### Explanation

The `form` parameter is the form store to retrieve the error entry from. The optional `config` parameter scopes the search to a specific field's subtree via a `path` (when omitted, the entire form is walked). The function walks through the field store and all its descendants in depth-first order and stops at the first field with errors, so errors of a field surface before errors of its descendants. The returned entry contains the `path` to the field and its non-empty list of `errors`. Form-level errors are included with an empty path.

## Returns

- `result` `DeepErrorEntry<v.InferInput<TSchema>> | null`

## Related

### Primitives

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

### Methods

[`getErrors`](/methods/api/getErrors.md), [`getDeepError`](/methods/api/getDeepError.md), [`getDeepErrorEntries`](/methods/api/getDeepErrorEntries.md), [`validate`](/methods/api/validate.md)
