{"record":{"id":"d21d86357290900d","repo":"srbhr/Resume-Matcher","slug":"resume-wizard-failed-please-try-again","errorCode":null,"errorMessage":"Resume wizard failed. Please try again.","messagePattern":"Resume wizard failed\\. Please try again\\.","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"apps/backend/app/routers/resume_wizard.py","lineNumber":63,"sourceCode":"        # answer/skip turns and route the user to review instead of advancing.\n        if request.state.asked_count >= RESUME_WIZARD_MAX_QUESTIONS:\n            return ResumeWizardTurnResponse(state=apply_review(request.state))\n\n        if action == \"skip\":\n            state = await run_ai_turn(request.state, \"\", skip=True)\n            return ResumeWizardTurnResponse(state=state)\n\n        answer_text = request.answer.text if request.answer else \"\"\n        state = await run_ai_turn(request.state, answer_text, skip=False)\n        return ResumeWizardTurnResponse(state=state)\n    except HTTPException:\n        raise\n    except ValueError as e:\n        logger.error(\"Resume wizard turn validation failed: %s\", e)\n        raise HTTPException(status_code=422, detail=\"Could not update the resume draft.\")\n    except Exception as e:\n        logger.error(\"Resume wizard turn failed: %s\", e)\n        raise HTTPException(\n            status_code=500,\n            detail=\"Resume wizard failed. Please try again.\",\n        )\n\n\n@router.post(\"/finalize\", response_model=ResumeWizardFinalizeResponse)\nasync def finalize_resume_wizard(\n    request: ResumeWizardFinalizeRequest,\n) -> ResumeWizardFinalizeResponse:\n    \"\"\"Create the master resume from a validated wizard draft.\"\"\"\n    try:\n        current_master = await db.get_master_resume()\n        if current_master and current_master.get(\"processing_status\") == \"ready\":\n            raise HTTPException(\n                status_code=409,\n                detail=\"A master resume already exists. Delete it before creating a new one.\",\n            )\n","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/srbhr/Resume-Matcher/blob/116f9cc3b00e1ac91734a6c2679bf41ea64a0edc/apps/backend/app/routers/resume_wizard.py#L45-L81","documentation":"A 500 raised by resume_wizard_turn for any unexpected exception from run_ai_turn that is not an HTTPException or ValueError — typically failures inside the AI turn pipeline itself. Signals an unhandled server-side problem; the cause is logged as 'Resume wizard turn failed'.","triggerScenarios":"AI provider call fails (network, timeout, quota, invalid API key); unexpected None/malformed structure returned by the AI and dereferenced; database error while loading/saving wizard state that isn't a ValueError.","commonSituations":"Missing or expired LLM API key in the environment; provider rate limits or outage; prompt/response schema change in the AI layer breaking parsing; DB connectivity loss mid-turn.","solutions":["Check server logs for 'Resume wizard turn failed' to identify the root exception","Verify the AI provider credentials, quota, and connectivity (often an env/config issue)","Retry the request — transient provider outages resolve on retry with backoff","If parsing-related, pin/fix the AI response schema handling in run_ai_turn"],"exampleFix":"// before: no handling, user sees raw 500\nawait submitWizardTurn(state, answer);\n// after\ntry {\n  await submitWizardTurn(state, answer);\n} catch (e) {\n  if (e.response?.status === 500) {\n    showToast('Wizard is temporarily unavailable; retrying...');\n    await retryWithBackoff(() => submitWizardTurn(state, answer));\n  } else throw e;\n}","handlingStrategy":"retry","validationCode":"// Pre-flight: confirm AI provider is configured before starting the wizard\nif (!process.env.LLM_API_KEY) throw new ConfigError('LLM_API_KEY missing — wizard turns will fail');","typeGuard":null,"tryCatchPattern":"try {\n  await api.post('/resume-wizard/turn', { state, answer });\n} catch (e) {\n  if (e.response?.status === 500) {\n    await retryWithBackoff(() => api.post('/resume-wizard/turn', { state, answer }), { retries: 2, baseMs: 1000 });\n  } else throw e;\n}","preventionTips":["Ensure LLM API keys and quotas are configured in the environment","Distinguish ValueError (validation → 422) from infrastructure errors in run_ai_turn","Add provider timeouts and circuit breakers so failures surface fast","Alert on 'Resume wizard turn failed' log spikes"],"tags":["http","internal-server-error","ai-provider","fastapi"],"backgroundTag":"llm-call-failed","analyzedSha":"116f9cc3b00e1ac91734a6c2679bf41ea64a0edc","analyzedAt":"2026-08-28T22:51:40.999Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}