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'.

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)

Solutions

  1. Check backend logs for 'Interview preparation generation failed' to see the underlying exception.
  2. Verify the LLM provider API key and quota (env vars, billing, rate limits).
  3. Retry the request — transient provider timeouts/429s often resolve on retry with backoff.
  4. 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

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


AI-assisted analysis of srbhr/Resume-Matcher@116f9cc3b0 (2026-08-28). Data as JSON: /api/errors/87739d0ece77c49b. Report an issue: GitHub.