Validation failed
Identifiers
Section titled “Identifiers”| Field | Value |
|---|---|
| Type URI | https://echo.labstack.com/pro/problems/validation-failed |
| Code | validation_failed |
| HTTP status | 400 |
| HTTP status | English title |
|---|---|
| 400 | Bad Request |
When it occurs
Section titled “When it occurs”The OpenAPI validator or your application validator rejected the request before the handler ran.
Client handling
Section titled “Client handling”Correct the request before retrying. Read detail if the application returns it; HideValidationDetail can omit it.
Example response
Section titled “Example response”If your application installs a custom handler, the body may differ.
HTTP/1.1 400 Bad RequestContent-Type: application/problem+json
{ "code": "validation_failed", "status": 400, "title": "Bad Request", "type": "https://echo.labstack.com/pro/problems/validation-failed"}Server correction
Section titled “Server correction”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.
Response fields
Section titled “Response fields”OpenAPI middleware chain
Section titled “OpenAPI middleware chain”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
MismatchErrortoOnErroronce per operation. Handler errors are not converted. - The default OpenAPI
ProblemHandlerwrites RFC 9457 JSON withContent-Type: application/problem+json. It includestype,title,status,codeand optionaldetail.detailcontains the validator’s first line without control characters, limited to 256 bytes.HideValidationDetailomits 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.
Your application (problem.NewError)
Section titled “Your application (problem.NewError)”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 withproblem.NewError. Omitted when you set none.
Headers:
Cache-Control(conditional):no-store, set byproblem/echoadapter.Content-Language(conditional):enorja, set byproblem/echoadapterfrom its configured language.
Notes:
- The adapter keeps existing
WWW-Authenticate,AllowandRetry-Afterheaders and adds no challenge or retry advice of its own. - On HEAD, the adapter’s
Content-Lengthequals 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.
Related behavior
Section titled “Related behavior”See the problem catalog for application error handling.