{"record":{"id":"2fe8ccb75bf214b7","repo":"lfnovo/open-notebook","slug":"error-updating-session-str-e","errorCode":null,"errorMessage":"Error updating session: {str(e)}","messagePattern":"Error updating session: (.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"api/routers/chat.py","lineNumber":280,"sourceCode":"\n        return ChatSessionResponse(\n            id=session.id or \"\",\n            title=session.title or \"\",\n            notebook_id=notebook_id,\n            created=str(session.created),\n            updated=str(session.updated),\n            message_count=msg_count,\n            model_override=session.model_override,\n        )\n    except NotFoundError:\n        raise HTTPException(status_code=404, detail=\"Session not found\")\n    except HTTPException:\n        raise\n    except OpenNotebookError:\n        raise\n    except Exception as e:\n        logger.error(f\"Error updating session: {str(e)}\")\n        raise HTTPException(status_code=500, detail=f\"Error updating session: {str(e)}\")\n\n\n@router.delete(\"/chat/sessions/{session_id}\", response_model=SuccessResponse)\nasync def delete_session(session_id: str):\n    \"\"\"Delete a chat session.\"\"\"\n    try:\n        # Get session (normalizes the ID and 404s if missing)\n        _full_session_id, session = await get_session_or_404(session_id)\n\n        await session.delete()\n\n        return SuccessResponse(success=True, message=\"Session deleted successfully\")\n    except NotFoundError:\n        raise HTTPException(status_code=404, detail=\"Session not found\")\n    except HTTPException:\n        raise\n    except OpenNotebookError:\n        raise","sourceCodeStart":262,"sourceCodeEnd":298,"githubUrl":"https://github.com/lfnovo/open-notebook/blob/a7de90d38aaf18ee85fd661854d35c11e44613e2/api/routers/chat.py#L262-L298","documentation":"Generic 500 from PUT /chat/sessions/{session_id} when the update fails unexpectedly (outside the known error types). Cause logged as 'Error updating session: ...'.","triggerScenarios":"session.save() failing on DB outage, empty/invalid title payload causing validation downstream, or schema constraint failure.","commonSituations":"SurrealDB unavailable; title with unusual length/content; schema drift after migrations.","solutions":["Check the 'Error updating session' log entry for the exception","Verify DB connectivity and that the session row still exists","Retry with a simple title to isolate payload issues"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"catch (e) { if (e.status === 500) retryWithBackoff(); else throw e; }","preventionTips":["Trim/validate title client-side","Check DB health on repeated failures"],"tags":["http-500","internal-error","chat-session"],"backgroundTag":"unhandled-server-exception","analyzedSha":"a7de90d38aaf18ee85fd661854d35c11e44613e2","analyzedAt":"2026-08-27T02:39:58.166Z","schemaVersion":2},"datasetVersion":"2026-08-27T03:17:27.898Z"}