srbhr/Resume-Matcher · error · HTTPException

Failed to save changes. Please try again.

Error message

Failed to save changes. Please try again.

What it means

A 500 raised by apply_regenerated_items when saving the merged regenerated content to the database throws an unexpected exception. The error is logged server-side with the underlying exception; the client only sees a generic save-failure message.

Source

Thrown at apps/backend/app/routers/enrichment.py:801

            detail=(
                "Resume content changed or could not be uniquely matched. "
                "Please regenerate and try again."
            ),
        )

    # Update the resume in database
    updated_content = json.dumps(updated_data, indent=2)
    try:
        await db.update_resume(
            resume_id,
            {
                "content": updated_content,
                "processed_data": updated_data,
            },
        )
    except Exception as e:
        logger.error(f"Failed to save regenerated content to database: {e}")
        raise HTTPException(
            status_code=500,
            detail="Failed to save changes. Please try again.",
        )

    return {
        "message": "Changes applied successfully",
        "updated_items": len(regenerated_items),
    }

View on GitHub (pinned to 116f9cc3b0)

Solutions

  1. Retry the apply request — the failure may be transient (check server logs for the underlying exception)
  2. Verify database connectivity and that the resumes table schema accepts the updated fields
  3. Inspect server logs for 'Failed to save regenerated content to database' to find the real exception
  4. If schema-related, fix the payload shape or run the pending migration

Example fix

// before: blind retry loop
await applyRegenerated(resumeId, items);
// after: retry transient failures with backoff
try {
  await applyRegenerated(resumeId, items);
} catch (e) {
  if (e.response?.status === 500) await sleep(1000); // then retry once
  else throw e;
}
Defensive patterns

Strategy: retry

Validate before calling

// Nothing to pre-validate (server-side save failure); ensure payload size is sane before sending
if (JSON.stringify(payload).length > 1_000_000) throw new Error('Payload too large');

Try / catch

try {
  await api.post(`/enrichment/${resumeId}/apply-regenerated`, payload);
} catch (e) {
  if (e.response?.status === 500) {
    await retryWithBackoff(() => api.post(`/enrichment/${resumeId}/apply-regenerated`, payload), { retries: 2 });
  } else throw e;
}

Prevention

When it happens

Trigger: Database connection failure or timeout during the resume update write; a schema/validation error in updated_content or processed_data rejected by the DB layer; any exception raised inside the update call after items were matched.

Common situations: DB pool exhausted or Postgres restarted; processed_data grew past a size limit; a migration changed the resumes table so the update payload no longer fits the schema.

Related errors


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