Skip to content

[Bug]: HTTP 422 Validation Failures Due to Query Parameter Mismatch #1075

Description

@AdityaNarayanPadhi

Bug Summary

The frontend makes recommendation calls using title in the query string, which mismatch the backend's expected item_title parameter, causing continuous HTTP 422 errors.

Describe the bug

The frontend client in app.js makes HTTP GET requests to /api/recommend?title=.... The backend route get_recommendations expects a query parameter named item_title. Because item_title has no default value and is not found, FastAPI rejects every query-based recommendation request with a 422 Unprocessable Entity response.

To Reproduce

Load the frontend dashboard index page.
Click on a product card to request recommendations.
Observe the browser network logs. An HTTP 422 error is returned for /api/recommend?title=....
The frontend is forced to run a fallback query /api/recommend/{item_title} after catching the error.

Expected behavior

The frontend's query-based request /api/recommend?title=... should match the backend's parameter expectation, succeeding on the first round trip.

Actual behavior

FastAPI returns an HTTP 422 validation error: {"detail": [{"loc": ["query", "item_title"], "msg": "field required", "type": "value_error.missing"}]}.

Screenshots / Error Logs

No response

OS

No response

Python version

No response

Browser (if frontend issue)

No response

Additional context

No response

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions