Skip to content

Request contract invalid

The answer a preview environment’s own address gives to a request that breaks the OpenAPI contract the environment refuses requests against.

Field Value
type https://mockhub.dev/problems/request-contract-invalid
Status 422

The environment is in Reject mode, and the check found that the request breaks the operation it is held to at the revision the environment is pinned to. It is MockHub’s refusal, not an answer a mock or your upstream sent. Nothing else happened: no mock matched, no scenario moved, no data store write ran and no callback fired. The refused request still counts against the plan’s request quota.

Always 422.

Only from the address of an ephemeral project in Reject mode, never from the management API. A CORS preflight and a post to the webhook inbox are not refused.

When detail
The request breaks the contract in one or more places The request breaks the project's OpenAPI contract (revision <n>) in <n> place(s), so it was not served.

The body adds contractRevision, the revision checked, and findings: each finding names a code, where it was found (location), the parameter name, the instance pointer in the body, the pointer of the rule in the document and its keyword. A finding never holds a value you sent. truncated is true when there were more findings than are listed.

{
"type": "https://mockhub.dev/problems/request-contract-invalid",
"title": "Request breaks the contract",
"status": 422,
"detail": "The request breaks the project's OpenAPI contract (revision 2) in 1 place, so it was not served.",
"contractRevision": 2,
"findings": [
{
"code": "parameter-required",
"location": "query",
"name": "page"
}
],
"truncated": false
}

Fix the request so it meets the operation the finding names, then send it again. If the contract is what is wrong, update it and pin the environment to the new revision, or set the mode to Report to see findings without refusing. The refusal is kept in the request logs with its check.

Report a problem with this page