# Server errors

FormStore supports server.set/create returning a response object with error information in this format:

| Property     | Data type                  | Description                                                                                                                                                                                                                                                                                                              |
| ------------ | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| status       | String                     | Must be 'error' to enable the processing of error message(s).                                                                                                                                                                                                                                                            |
| error        | String or Object           | If a string, it is placed into model.serverError and it will be the first element ofthe model.status.errors Array. (A typical use case is a general error like failed authentication). If an object, it's copied over to model.dataErrors, so this allows the server to return validation errors for each data property. |
| error\_field | String or Array of Strings | Optional. Either a single field name as a string or an array of field names *also* considered in error. **Any such field that does not have something in dataErrors\[name] (after copying error object above) will be reverted to a known-good value if auto-save is enabled**.                                          |

The combined list of fields in error (error object keys and field(s) in error\_field) are fields that the server designated as being in error. Therefore, the updated value of each field in this list is NOT placed into the saved/known-good data in the model, like it normally happens at the end of a successful save().

## Using error codes and client-side validation message formatting

For each property in error, instead of returning a String, the server can return an object in tv4 validation error format, i.e. with code and optional message property. When using [MobxSchemaForm](/mobx-forms/mobx-schema-form/mobxschemaform.md), such objects will be converted into messages using templates defined for the code in validationMessage property in that field's [Form Field Metadata](/mobx-forms/mobx-schema-form/form-field-metadata.md) (or options.formDefaults passed to MobxSchemaForm).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://alexhisen.gitbook.io/mobx-forms/formstore/formstore-server-errors.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
