Jev 422 Invalid Request: Schema Checks and Fixes
Fix missing state, model, instructions, Choice criteria, Score levels, and malformed JSON.
On this page
What 422 meansRequest checklistA common bad requestCheck the full bodyContext and provider differencesWhen to retryWhat 422 means
The server understood the request format but rejected its schema or field values. Inspect the response’s validation details and isolate the named field. Avoid changing a semantic prompt when the real problem is a missing property.
Request checklist
stateexists and is a supported string, object, or array.modelis present and available on the selected provider.questionsis a map keyed by your chosen question IDs.- Each question uses the supported
type:choice,score, ornoul. - Every question contains
instructions(plural). - Choice contains a
criteriamap with no more than 255 options. - Score contains an ordered
criteriaarray with 2–10 levels. - The JSON is valid and numeric values are finite.
A common bad request
{"type":"choice","instruction":"Which team?","options":["billing","support"]}
This mixes invented fields with the direct API. The corrected question is:
{"type":"choice","instructions":"Which team owns the ticket?","criteria":{"billing":"Payments and refunds","support":"Technical help"}}
The direct API uses a map for Choice and an array of descriptions for Score. An integer such as levels: 5 does not supply a rubric.
Check the full body
A valid question fragment is not a complete API request. Wrap it in questions, and include state and model. Use the complete request file as a baseline. Add one field at a time until the failure returns.
Context and provider differences
Check both context budgets if validation points to request size. Do not assume Vercel’s decision interface uses the direct schema; its boolean naming and helper APIs are provider-specific. Keep provider adapters separate so a fix to one does not corrupt another.
When to retry
After fixing the request, retry the minimal case once and inspect the result. Repeating a malformed body with exponential backoff only wastes time. Add request-shape tests around your adapter, especially when installing a new SDK version or generating criteria dynamically.