srbhr/Resume-Matcher · warning · HTTPException

No job descriptions provided

Error message

No job descriptions provided

What it means

A 400 Bad Request from upload_job_descriptions when the request body's job_descriptions field is missing, null, or an empty array. The endpoint requires at least one job description string to store for later resume tailoring.

Source

Thrown at apps/backend/app/routers/jobs.py:19

"""Job description management endpoints."""

from fastapi import APIRouter, HTTPException

from app.database import db
from app.schemas import JobUploadRequest, JobUploadResponse

router = APIRouter(prefix="/jobs", tags=["Jobs"])


@router.post("/upload", response_model=JobUploadResponse)
async def upload_job_descriptions(request: JobUploadRequest) -> JobUploadResponse:
    """Upload one or more job descriptions.

    Stores the raw text for later use in resume tailoring.
    Returns an array of job_ids corresponding to the input array.
    """
    if not request.job_descriptions:
        raise HTTPException(status_code=400, detail="No job descriptions provided")

    job_ids = []
    for jd in request.job_descriptions:
        if not jd.strip():
            raise HTTPException(status_code=400, detail="Empty job description")

        job = await db.create_job(
            content=jd.strip(),
            resume_id=request.resume_id,
        )
        job_ids.append(job["job_id"])

    return JobUploadResponse(
        message="data successfully processed",
        job_id=job_ids,
        request={
            "job_descriptions": request.job_descriptions,
            "resume_id": request.resume_id,

View on GitHub (pinned to 116f9cc3b0)

Solutions

  1. Include at least one non-empty string in the job_descriptions array before calling the endpoint
  2. Fix client-side splitting/filtering so blank text isn't reduced to an empty array
  3. Return a clear client-side validation error before sending the request

Example fix

// before
await api.post('/jobs/upload', { job_descriptions: texts.filter(Boolean) });
// after: guard client-side
const cleaned = texts.map(t => t.trim()).filter(Boolean);
if (cleaned.length === 0) throw new ValidationError('At least one job description is required');
await api.post('/jobs/upload', { job_descriptions: cleaned, resume_id });
Defensive patterns

Strategy: validation

Validate before calling

function validateJobUpload(body) {
  const jds = (body.job_descriptions ?? []).map(s => String(s).trim()).filter(Boolean);
  if (jds.length === 0) throw new ValidationError('job_descriptions must contain at least one non-empty string');
  return { ...body, job_descriptions: jds };
}

Type guard

function hasJobDescriptions(b) {
  return Array.isArray(b?.job_descriptions) && b.job_descriptions.length > 0;
}

Try / catch

try {
  await api.post('/jobs/upload', body);
} catch (e) {
  if (e.response?.status === 400 && e.response.data?.detail === 'No job descriptions provided') {
    showFormError('Please paste at least one job description.');
  } else throw e;
}

Prevention

When it happens

Trigger: POSTing a JobUploadRequest with job_descriptions omitted, set to null, or set to []; sending a body that fails to include the field the client-side serializer dropped (e.g. empty arrays stripped).

Common situations: Client builds the payload from a textarea split that yields an empty list after filtering; a form submitted without pasting any job text; API consumers testing the endpoint with {} as the body.

Related errors


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