{"record":{"id":"32edb4ce2861d115","repo":"srbhr/Resume-Matcher","slug":"could-not-create-master-resume","errorCode":null,"errorMessage":"Could not create master resume.","messagePattern":"Could not create master resume\\.","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"apps/backend/app/routers/resume_wizard.py","lineNumber":123,"sourceCode":"                    resume.get(\"resume_id\"),\n                    e,\n                )\n            raise HTTPException(\n                status_code=409,\n                detail=\"A master resume already exists. Delete it before creating a new one.\",\n            )\n        return ResumeWizardFinalizeResponse(\n            message=\"Master resume created.\",\n            request_id=str(uuid4()),\n            resume_id=resume[\"resume_id\"],\n            processing_status=\"ready\",\n            is_master=resume.get(\"is_master\", False),\n        )\n    except HTTPException:\n        raise\n    except Exception as e:\n        logger.error(\"Resume wizard finalize failed: %s\", e)\n        raise HTTPException(status_code=500, detail=\"Could not create master resume.\")\n","sourceCodeStart":105,"sourceCodeEnd":124,"githubUrl":"https://github.com/srbhr/Resume-Matcher/blob/116f9cc3b00e1ac91734a6c2679bf41ea64a0edc/apps/backend/app/routers/resume_wizard.py#L105-L124","documentation":"A 500 raised at the end of finalize_resume_wizard when any non-HTTPException error occurs during master resume creation (normalization, persistence, cleanup of old wizard resumes). The real cause is logged as 'Resume wizard finalize failed'; clients get this generic message.","triggerScenarios":"db.create_master_resume (or equivalent save) fails — DB down, constraint violation; normalize_resume_data throws on unexpected wizard state content; cleanup of a previous non-master wizard resume raises an unexpected error outside its guarded try.","commonSituations":"Wizard resume_data contains values the normalizer doesn't handle (nulls, odd types from the AI); database constraint/size limits hit; DB connectivity lost between validation and write.","solutions":["Check server logs for 'Resume wizard finalize failed' to find the underlying exception","Retry finalize — transient DB failures often succeed on retry","Validate request.state.resume_data contents before calling finalize (no nulls in required fields)","Fix normalize_resume_data handling if the wizard state produces unsupported shapes"],"exampleFix":"// before\nawait api.post('/resume-wizard/finalize', { state });\n// after\ntry {\n  await api.post('/resume-wizard/finalize', { state });\n} catch (e) {\n  if (e.response?.status === 500) {\n    notify('Master resume creation failed — please retry');\n  } else throw e;\n}","handlingStrategy":"try-catch","validationCode":"function isFinalizable(state) {\n  const rd = state?.resume_data;\n  return rd != null &&\n    Array.isArray(rd.experience) && rd.experience.every(e => e?.title && e?.company) &&\n    Array.isArray(rd.skills);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await api.post('/resume-wizard/finalize', { state });\n} catch (e) {\n  if (e.response?.status === 500) {\n    showToast('Master resume creation failed; retrying...');\n    await retryWithBackoff(() => api.post('/resume-wizard/finalize', { state }), { retries: 1 });\n  } else throw e;\n}","preventionTips":["Validate resume_data shape before finalize (required fields non-null)","Retry 500s once with backoff; persist the wizard state so retries are lossless","Check DB connectivity/constraints if finalize fails repeatedly","Investigate 'Resume wizard finalize failed' logs to fix normalization gaps"],"tags":["http","internal-server-error","database","fastapi"],"backgroundTag":"record-creation-failed","analyzedSha":"116f9cc3b00e1ac91734a6c2679bf41ea64a0edc","analyzedAt":"2026-08-28T22:51:40.999Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}