HKUDS/DeepTutor · error · HTTPException

{exception message}

Error message

{exception message}

What it means

HTTP 500 raised by the notebook route handlers in deeptutor/api/routers/notebook.py:197 as a catch-all: after NotebookCorruptedError is mapped to a specific 4xx via _unreadable, any remaining unexpected exception (I/O failure, manager bug, unexpected data shape) is converted to detail=str(e). Trigger scenarios: unreadable storage backend during list_notebooks, corrupted metadata, or unforeseen runtime exceptions in any handler using this pattern.

Solutions

  1. Wrap the list_notebooks call in try/except and log the underlying exception with the traceback before re-raising
  2. Return a structured 500 payload (e.g. {detail: 'notebook listing failed'}) instead of leaking str(e) to clients
  3. Distinguish expected notebook-store failures from programming errors and map them to appropriate status codes
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at deeptutor/api/routers/notebook.py:197 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of HKUDS/DeepTutor@3e82f13042 (2026-08-27). Data as JSON: /api/errors/a425fa2bc4a80d9d. Report an issue: GitHub.

Appendix: source

Thrown at deeptutor/api/routers/notebook.py:197

    """Health check"""
    return {"status": "healthy", "service": "notebook"}


@router.get("/list")
async def list_notebooks():
    """
    Get all notebook list

    Returns:
        Notebook list (includes summary information)
    """
    try:
        notebooks = notebook_manager.list_notebooks()
        return {"notebooks": notebooks, "total": len(notebooks)}
    except NotebookCorruptedError as exc:
        raise _unreadable(exc)
    except Exception as e:
        raise HTTPException(status_code=500, detail=str(e))


@router.get("/statistics")
async def get_statistics():
    """
    Get notebook statistics

    Returns:
        Statistics information
    """
    try:
        stats = notebook_manager.get_statistics()
        return stats
    except NotebookCorruptedError as exc:
        raise _unreadable(exc)
    except Exception as e:
        raise HTTPException(status_code=500, detail=str(e))

View on GitHub (pinned to 3e82f13042)