[Bug]: Unhandled ValueError in recommender.py for invalid time_availability causes 500 Internal Server Error
Describe the bug In utils/recommender.py, the score_single_project function calls .index() on the TIME_AVAILABILITY list using the time_availability parameter from the user payload. Because validate_recommendation_inputs only checks if the input is non-empty (and doesn't check if it's a valid enum), sending an unrecognized time value causes a ValueError: '...' is not in list, crashing the server and returning a 500 Internal Server Error.
To Reproduce-
1.Send a POST request to /api/recommend with the payload: {"skills": "python", "level": "Beginner", "interest": "Data", "time": "unknown"} 2.The server will throw a ValueError at line 72 in utils/recommender.py and crash. Expected behavior: The input validation should check if time_availability is one of the allowed values (['low', 'medium', 'high']). If not, it should gracefully return a 400 Bad Request instead of crashing.
Proposed Solution: I can fix this by adding a check inside validate_recommendation_inputs in utils/recommender.py to ensure time_availability.lower() in ['low', 'medium', 'high'].
I am a GSSoC 2026 contributor and would love to fix this issue immediately. Please assign it to me!
@komalharshita I am a GSSoC 2026 contributor and would love to fix this issue immediately. Please assign it to me!
Thank you for opening your first issue in DevPath.
Please make sure to:
- Read CONTRIBUTING.md
- Wait for assignment before starting work
- Follow repository guidelines carefully
Happy contributing.
Hi, I would like to work on this issue under GSSoC'26. Please assign it to me.
Hi, I noticed this issue is linked with #659. I have reviewed the related files and would like to work on this specific bug/fix. Kindly let me know if I can proceed with a PR. @komalharshita
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions!