MethodArgumentNotValidException Java Origin: Application & API Last updated 13 Oct 2026

MethodArgumentNotValidException: Validation failed for argument [0]

Bean Validation (@Valid with @NotNull, @Email, @Size…) rejected the request body.

Exact message you may see Validation failed for argument
Seen on: Java

Meaning

Spring returns 400 by default. The exception lists each field error — expose them to clients instead of a generic error.

Common causes

  • Missing required fields
  • Constraint violations (format, size)
  • Client/server field name mismatch

⚡ Quick fix

  1. Return field errors from an @ControllerAdvice
  2. Align DTO constraints with the client
  3. Check the defaultMessage per field

Detailed fix by platform

Java

  1. @ExceptionHandler(MethodArgumentNotValidException.class) ResponseEntity<?> handle(MethodArgumentNotValidException e) { return ResponseEntity.badRequest().body(e.getBindingResult().getFieldErrors()); }

How to diagnose

  1. Fields — Which field errors are listed?
  2. Recent change — Did it start after a deploy, upgrade, or configuration change? Compare with the last working version.

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Application & API. Errors that are often confused with or caused by this one (click to open):

400 — HTTP 400 Bad Request (HTTP)400422 — HTTP 422 Unprocessable Content (HTTP)422circular references — The dependencies of some of the beans in the application context form a cycle (Java)circular referencesDataSource url not specified — Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured. (Java)DataSource url not sp…Document failed validation — MongoDB: MongoServerError: Document failed validation (code 121) (MongoDB)Document failed valid…error converting YAML to JSON — error converting YAML to JSON: yaml: line 12: did not find expected key (Kubernetes)error converting YAML…HttpMessageNotReadableException — HttpMessageNotReadableException: JSON parse error / Required request body is missing (Java)HttpMessageNotReadabl…IllegalArgumentException — java.lang.IllegalArgumentException (Java)IllegalArgumentExcept…MethodArg…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.