srbhr/Resume-Matcher · error · HTTPException
Failed to generate interview preparation. Please try again.
Error message
Failed to generate interview preparation. Please try again.
What it means
HTTP 500 raised when the interview-prep generation service throws any exception. The handler logs the original error with logger.exception and converts it into a generic 500 so internal details (API keys, prompts, stack traces) are not leaked to the client. The real cause is in the server logs under 'Interview preparation generation failed'.
Solutions
- Check backend logs for 'Interview preparation generation failed' to see the underlying exception.
- Verify the LLM provider API key and quota (env vars, billing, rate limits).
- Retry the request — transient provider timeouts/429s often resolve on retry with backoff.
- Reduce resume/job description size if context-limit errors appear in the logs.
Example fix
// before
except Exception as e:
logger.exception("Interview preparation generation failed: %s", e)
raise HTTPException(status_code=500, detail="Failed to generate interview preparation. Please try again.")
// after (retry transient failures before giving up)
except TransientProviderError:
... # retry with backoff
except Exception as e:
logger.exception("Interview preparation generation failed: %s", e)
raise HTTPException(status_code=500, detail="Failed to generate interview preparation. Please try again.") Defensive patterns
Strategy: retry
Validate before calling
const resume = await getResume(id);
const imp = resume?.improvement;
if (!imp?.job_id) throw new SkipError('no job context for prep');
if ((resume.processed_data?.raw_text || '').length === 0) throw new SkipError('empty resume text'); Try / catch
try {
return await withBackoff(() => generateInterviewPrep(resumeId), {retries: 2});
} catch (e) {
if (e.status === 500) showRetryableError('Generation failed — check provider status or try again later.');
else throw e;
} Prevention
- Check backend logs ('Interview preparation generation failed') for the root cause before retrying blindly.
- Monitor LLM provider status, quotas, and API-key validity.
- Cap resume/job text size before sending to the generator to avoid context-limit failures.
- Use exponential backoff for transient provider errors.
When it happens
Trigger: The AI/LLM call inside the interview-prep generator raises — e.g. invalid/expired API key, rate limit, timeout, empty job['content'] or resume_data, or malformed prompt output that fails parsing.
Common situations: Missing or rotated LLM provider credentials in env; provider outage or 429 rate limiting; extremely large resume/job content exceeding context limits; unexpected response shape from the model breaking JSON parsing.
Related errors
- detail
- A master resume already exists. Delete it before creating a…
- Content too large for JSON extraction
- Could not create master resume.
- Could not update the resume draft.
AI-assisted analysis of srbhr/Resume-Matcher@116f9cc3b0 (2026-08-28).
Data as JSON: /api/errors/87739d0ece77c49b.
Report an issue: GitHub.
Appendix: source
Thrown at apps/backend/app/routers/resumes.py:1963
resume_data = resume.get("processed_data")
if not resume_data:
raise HTTPException(
status_code=400,
detail="Resume has no processed data. Please re-upload the resume.",
)
language = get_content_language()
try:
interview_prep = await generate_interview_prep(
resume_data,
job["content"],
language,
)
except Exception as e:
logger.exception("Interview preparation generation failed: %s", e)
raise HTTPException(
status_code=500,
detail="Failed to generate interview preparation. Please try again.",
)
await db.update_resume(
resume_id,
{"interview_prep": _serialize_interview_prep(interview_prep)},
)
return GenerateInterviewPrepResponse(
interview_prep=interview_prep,
message="Interview preparation generated successfully",
)
@router.get("/{resume_id}/job-description")
async def get_job_description_for_resume(resume_id: str) -> dict:
"""Get the job description used to tailor this resume.View on GitHub (pinned to 116f9cc3b0)