On this page
What this issue is
A visitor fills in your form, presses submit, and sees text such as error 422, Unprocessable Entity, 400 Bad Request or {"errors":{"email":["invalid"]}}. These are messages meant for developers. The code 422 means the server understood the request but rejected the data in it, for example a bad email, a missing field or a value that failed a rule.
Why it costs you leads or sales
A code tells the visitor nothing about what to change. Many will assume the site is broken, leave, or retry the same data and fail again. Some will think their details were sent when they were not. It also looks untrustworthy, which matters most on forms that ask for contact or payment details.
- Ad or search clickVisitor lands on the page
- Fills in formEnters details and submits
- Server rejects dataReturns 422
- Raw 'error 422' shownNo hint what to fix
- Lead submittedNever happens
The form reaches the server, but the rejection is shown as a code and the lead never completes.
Example: illustrative numbers only, showing how a clear message could keep more visitors than a raw code.
How to check if your site has it
A form filled in correctly will never show this. You have to make it fail on purpose.
Submit with bad data
Enter an invalid email such as
test@, leave required fields empty, and use a very long text in a short field. Submit each case separately.Read what appears
Look for numbers, words like 'Unprocessable', 'Bad Request', 'Forbidden', JSON in braces, or 'undefined' and 'null'.
Open the browser's network panel
In Chrome press F12, open the Network tab, submit again and click the form request. Note the status (422, 400, 500) and the response body.
Repeat on mobile and with JavaScript-heavy steps
Test multi-step forms, popups and embedded forms from your CRM, because each may handle errors differently.
How to fix it
The principle is the same everywhere: turn each failure status into a short sentence that says what went wrong and what to do. Put it next to the field, keep what the visitor typed, and use a generic fallback such as 'Something went wrong. Please try again or email us at ...' for unexpected errors.
Find the form plugin's messages
In Contact Form 7 open the form, then the Messages tab. In WPForms use Settings > Confirmations and Settings > General. In Gravity Forms use the form's Settings and field validation messages. Rewrite each in plain words.
Check for a theme or custom script
If the raw code still shows, a custom AJAX script or a theme override is printing the response. Search the theme for
responseTextorstatusText.Disable conflicts
A security or caching plugin can block the request and return an error. Disable them one at a time on a staging site to find which one.
Use the built-in form messages
Liquid contact forms show errors through
form.errors. Make sure your theme renders them, usually inmain-contact-form.liquidor the newsletter section.Check third-party form apps
If an app embeds the form, edit its error text in the app's settings, or contact the app's support if the code comes from its script.
Know its limits
GTM does not create form errors, but a custom HTML tag that handles submissions can. Review any tag that intercepts the form or posts data, and make sure it shows a friendly message on failure.
Edit the error state
Select the form block, open the Form Settings and the Error state in the Navigator, then replace the default text with a clear message.
Check custom code or third-party endpoints
If the form posts to an external service, its error response may be shown raw. Handle failures in your custom JavaScript.
Review the form builder messages
In Sites > Forms, open the form and check required fields and the on-submit message. Use native validation so errors appear by the field.
Avoid custom scripts that post to the API
If you post to an API from your own code, add the error handler shown in the Custom code tab.
Edit the form's messages
In the editor select the form, open Settings and edit the error and validation messages. For Velo code, handle failures in a
catchblock and show your own text.
Edit the form block messages
Open the form block, go to the Storage or Advanced settings, and update the error text where offered. If a code injection script shows the error, replace it with the handler below.
Handle failed responses
Check
response.ok, read the JSON, and map field errors to messages. See the snippet below.Return structured errors from the server
Send field names with short human-readable messages, not stack traces or bare status codes.
const form = document.querySelector('#lead-form');
const box = document.querySelector('#form-error');
form.addEventListener('submit', async (e) => {
e.preventDefault();
box.textContent = '';
try {
const res = await fetch(form.action, { method: 'POST', body: new FormData(form) });
if (res.ok) { window.location.href = '/thank-you'; return; }
let msg = 'Something went wrong. Please try again.';
if (res.status === 422 || res.status === 400) {
const data = await res.json().catch(() => ({}));
const first = data.errors && Object.values(data.errors)[0];
msg = (Array.isArray(first) ? first[0] : first) || 'Please check the highlighted fields and try again.';
} else if (res.status === 429) {
msg = 'Too many attempts. Please wait a minute and try again.';
}
box.textContent = msg;
} catch (err) {
box.textContent = 'We could not reach the server. Check your connection and try again.';
}
});Before
- 'error 422' or raw JSON appears
- No field is highlighted
- Visitor does not know what to change
After
- 'Please enter a valid email address' appears under the field
- Typed data is kept
- Fallback message gives another way to reach you
How to confirm it's fixed
- Submit an invalid email: a plain message appears next to the field
- Submit with every required field empty: each gets a clear message
- Block the request in the Network panel (offline mode): the fallback message appears
- No status codes, JSON or 'undefined' appear anywhere on the page
- What the visitor typed is still in the form
- A valid submission still reaches your inbox or CRM
How to prevent it happening again
Raw errors often return after a plugin update, a theme change or a new form tool. Add a failed-submission test to your release checklist for every form change. Keep error text in one place so it is easy to review. Ask developers to return structured field errors rather than bare codes.
| Code | Likely meaning | Show the visitor |
|---|---|---|
| 400 | Request malformed or missing data | Please check your details and try again. |
| 403 | Blocked by security rule or expired token | Please refresh the page and try again. |
| 422 | Data failed validation | The specific field message, such as a valid email prompt. |
| 429 | Too many requests | Please wait a minute and try again. |
| 500 | Server fault | Something went wrong on our side. Please try again or contact us. |
How FunnelGuard handles this
FunnelGuard detects this only partly. A robot visitor runs your form journey on a schedule and its text_absent check can flag known codes: you tell it text that should never appear after submit, such as 422 or Unprocessable, and it raises an alert with a screenshot if that text shows up.
Day 1
A plugin update changes how the form returns errors
Day 2
Visitors with a typo see 'error 422' and leave
Day 10
Lead numbers dip but valid test submissions still work
Day 11
A scheduled check finds '422' on the page, or a manual bad-data test does
Questions people ask
Why does my form say 'error 422'?
The server received the form but rejected the data, for example an invalid email or a missing required field. Your form script then printed the status code instead of a friendly message. Fix the handler so it shows what to correct.
What does HTTP 422 Unprocessable Entity mean on a contact form?
It means the server understood the request but could not accept the content because it failed a rule. It is a validation failure, not a server crash. Visitors should see which field to fix.
How do I show a custom error message instead of a status code?
Check whether the response is successful, and if not, read the field errors from the response and display a plain sentence near the field. Add a generic fallback for unexpected errors. Most form plugins let you edit these messages in their settings.
Why do users see raw JSON or 'undefined' after submitting my form?
Your JavaScript is probably writing the response object straight into the page, or reading a field that does not exist. Parse the response and map it to your own message, with a fallback if the expected field is missing.
How do I test my form's error messages?
Submit bad data on purpose: an invalid email, empty required fields and over-long text. Read what appears, and check the Network tab for the status code. Also test with the connection offline to see the fallback.
Can FunnelGuard detect 'error 422' on my form?
Partly. Its text_absent check can flag codes you list, such as 422, if they appear on the page. It cannot judge whether other messages are clear, so test bad submissions by hand too.
Does a raw error message affect conversions?
Yes. The visitor cannot tell what to fix, and may think the site is broken and leave. A specific message next to the field gives them a way to finish.
Related issues
- CNV-032Validation error message not shown, form just does nothingFix guide
- CNV-033Error message shown in the wrong place or hidden off-screenFix guide
- CNV-034Errors clear all entered dataFix guide
- CNV-037Client and server validation disagree (passes client, server rejects)Fix guide
- CNV-029Valid email rejected (plus addressing, new TLDs)Fix guide
- CNV-031Required field can be left blank and the form still submitsFix guide