Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Form error shows 'error 422' to visitors: how to fix it

CNV-042Medium impactPartlyBy FunnelGuardPublished Updated
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.

Where the visitor is lost
  1. Ad or search clickVisitor lands on the page
  2. Fills in formEnters details and submits
  3. Server rejects dataReturns 422
  4. Raw 'error 422' shownNo hint what to fix
  5. Lead submittedNever happens

The form reaches the server, but the rejection is shown as a code and the lead never completes.

Visitors who retry after an errorExample numbers
Visitors who retry after an error (example)Raw 'error 422': 15 %; Clear field-level message: 60 %023461560Raw 'error 422'Clear field-level mes…%

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.

Trigger the error yourself
  1. 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.

  2. Read what appears

    Look for numbers, words like 'Unprocessable', 'Bad Request', 'Forbidden', JSON in braces, or 'undefined' and 'null'.

  3. 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.

  4. 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.

Fix by platform
  1. 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.

  2. 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 responseText or statusText.

  3. 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.

Show a friendly message when the server rejects the formjavascript
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.';
  }
});
What the visitor sees

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

Confirmation checks
  • 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.

Common codes and what to show instead
CodeLikely meaningShow the visitor
400Request malformed or missing dataPlease check your details and try again.
403Blocked by security rule or expired tokenPlease refresh the page and try again.
422Data failed validationThe specific field message, such as a valid email prompt.
429Too many requestsPlease wait a minute and try again.
500Server faultSomething 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.

How a raw error goes unnoticed
  1. Day 1

    A plugin update changes how the form returns errors

  2. Day 2

    Visitors with a typo see 'error 422' and leave

  3. Day 10

    Lead numbers dip but valid test submissions still work

  4. 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.

Does FunnelGuard catch this?

Partly

FunnelGuard checks part of this.

How: text_absent can flag codes.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.