lfnovo/open-notebook · error · HTTPException

Error updating session

Error message

Error updating session: {str(e)}

What it means

Generic 500 from PUT /chat/sessions/{session_id} when the update fails unexpectedly (outside the known error types). Cause logged as 'Error updating session: ...'.

Solutions

  1. Check the 'Error updating session' log entry for the exception
  2. Verify DB connectivity and that the session row still exists
  3. Retry with a simple title to isolate payload issues
Defensive patterns

Strategy: retry

Try / catch

catch (e) { if (e.status === 500) retryWithBackoff(); else throw e; }

Prevention

When it happens

Trigger: session.save() failing on DB outage, empty/invalid title payload causing validation downstream, or schema constraint failure.

Common situations: SurrealDB unavailable; title with unusual length/content; schema drift after migrations.

Related errors


AI-assisted analysis of lfnovo/open-notebook@a7de90d38a (2026-08-27). Data as JSON: /api/errors/2fe8ccb75bf214b7. Report an issue: GitHub.

Appendix: source

Thrown at api/routers/chat.py:280

        return ChatSessionResponse(
            id=session.id or "",
            title=session.title or "",
            notebook_id=notebook_id,
            created=str(session.created),
            updated=str(session.updated),
            message_count=msg_count,
            model_override=session.model_override,
        )
    except NotFoundError:
        raise HTTPException(status_code=404, detail="Session not found")
    except HTTPException:
        raise
    except OpenNotebookError:
        raise
    except Exception as e:
        logger.error(f"Error updating session: {str(e)}")
        raise HTTPException(status_code=500, detail=f"Error updating session: {str(e)}")


@router.delete("/chat/sessions/{session_id}", response_model=SuccessResponse)
async def delete_session(session_id: str):
    """Delete a chat session."""
    try:
        # Get session (normalizes the ID and 404s if missing)
        _full_session_id, session = await get_session_or_404(session_id)

        await session.delete()

        return SuccessResponse(success=True, message="Session deleted successfully")
    except NotFoundError:
        raise HTTPException(status_code=404, detail="Session not found")
    except HTTPException:
        raise
    except OpenNotebookError:
        raise

View on GitHub (pinned to a7de90d38a)