srbhr/Resume-Matcher · warning · HTTPException

Outreach message can only be generated for tailored resumes.

Error message

Outreach message can only be generated for tailored resumes. Please tailor this resume to a job description first.

What it means

400 raised when the resume exists but has no parent_id, i.e. it is an original uploaded resume rather than a resume tailored to a job. Outreach generation requires a tailored resume because the outreach content derives from the job context captured during tailoring.

Source

Thrown at apps/backend/app/routers/resumes.py:1857


@router.post("/{resume_id}/generate-outreach", response_model=GenerateContentResponse)
async def generate_outreach_endpoint(resume_id: str) -> GenerateContentResponse:
    """Generate an outreach message on-demand for an existing tailored resume.

    This endpoint allows users to generate a cold outreach message after a resume
    has been tailored. It requires:
    - The resume must be a tailored resume (has parent_id)
    - The resume must have an associated job context in the improvements table
    """
    # Get the resume
    resume = await db.get_resume(resume_id)
    if not resume:
        raise HTTPException(status_code=404, detail="Resume not found")

    # Check if it's a tailored resume (has parent_id)
    if not resume.get("parent_id"):
        raise HTTPException(
            status_code=400,
            detail="Outreach message can only be generated for tailored resumes. "
            "Please tailor this resume to a job description first.",
        )

    # Get improvement record to find the job_id
    improvement = await db.get_improvement_by_tailored_resume(resume_id)
    if not improvement:
        raise HTTPException(
            status_code=400,
            detail="No job context found for this resume. "
            "The resume may have been created before job tracking was implemented.",
        )

    # Get the job description
    job = await db.get_job(improvement["job_id"])
    if not job:
        raise HTTPException(

View on GitHub (pinned to 116f9cc3b0)

Solutions

  1. Tailor the resume to a job description first, then generate outreach for the tailored copy (the resume with parent_id set)
  2. Ensure the client sends the tailored resume ID, not the original resume ID
  3. Check resume.parent_id in the database if unsure which record to use

Example fix

// before
await generateOutreach(originalResume.id);
// after
const tailored = await tailorResume(originalResume.id, jobId);
await generateOutreach(tailored.id);
Defensive patterns

Strategy: validation

Validate before calling

const resume = await getResume(resumeId);
if (!resume?.parentId) {
  throw new Error('Resume is not tailored; tailor to a job first');
}
await api.generateOutreach(resumeId);

Type guard

function isTailored(r: Resume | null | undefined): r is Resume & { parentId: string } {
  return !!r && typeof r.parentId === 'string' && r.parentId.length > 0;
}

Try / catch

try {
  await api.generateOutreach(resumeId);
} catch (e) {
  if (e.response?.status === 400 && /tailored/i.test(e.response.data?.detail ?? '')) {
    return api.tailorResume(originalResumeId, jobId).then(t => api.generateOutreach(t.id));
  }
  throw e;
}

Prevention

When it happens

Trigger: POSTing the outreach generation route with the ID of a base/original resume (parent_id absent or null) instead of a tailored copy created from a job description.

Common situations: UI passing the wrong node of a resume tree, calling outreach before ever running the tailor step, or legacy resumes that predate the parent_id linking.

Related errors


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