Skip to content

Validation failed

FieldValue
Type URIhttps://echo.labstack.com/pro/problems/validation-failed
Codevalidation_failed
HTTP status400
HTTP statusEnglish title
400Bad Request

The OpenAPI validator or your application validator rejected the request before the handler ran.

Correct the request before retrying. Read detail if the application returns it; HideValidationDetail can omit it.

If your application installs a custom handler, the body may differ.

HTTP/1.1 400 Bad Request
Content-Type: application/problem+json
{
"code": "validation_failed",
"status": 400,
"title": "Bad Request",
"type": "https://echo.labstack.com/pro/problems/validation-failed"
}

Inspect the validation error in server diagnostics and return only safe field messages. A corrected request must still pass execution’s fingerprint checks; changing its key must not bypass duplicate protection.

  • type (string, always): The exact type URI above.
  • title (string, always): The HTTP status text.
  • status (integer, always): The HTTP status of the response.
  • detail (string, optional): Explanation text. Left out when empty.
  • code (string, always): The stable code above.

Notes:

  • The validator rejected the request before the handler ran. A validator 404/405 for an Echo-matched operation also returns this problem. The chain passes a MismatchError to OnError once per operation. Handler errors are not converted.
  • The default OpenAPI ProblemHandler writes RFC 9457 JSON with Content-Type: application/problem+json. It includes type, title, status, code and optional detail. detail contains the validator’s first line without control characters, limited to 256 bytes. HideValidationDetail omits it.
  • If the body is also too large and the response has not started, the client gets body_too_large. Validation runs after quota checks. The request is charged according to its settlement policy.
  • type (string, always): The exact type URI above.
  • title (string, always): The catalog title in the rendered language: English by default, Japanese only when the application selects it.
  • status (integer, always): The HTTP status of the response.
  • code (string, always): The stable code above.
  • detail (string, optional): Display text that your application sets, up to 256 bytes with problem.NewError. Omitted when you set none.

Headers:

  • Cache-Control (conditional): no-store, set by problem/echoadapter.
  • Content-Language (conditional): en or ja, set by problem/echoadapter from its configured language.

Notes:

  • The adapter keeps existing WWW-Authenticate, Allow and Retry-After headers and adds no challenge or retry advice of its own.
  • On HEAD, the adapter’s Content-Length equals the GET body’s length.
  • The application maps only its own validator’s refusal to this code and does not echo field values. A 400 from elsewhere keeps its own meaning.

See the problem catalog for application error handling.