HKUDS/DeepTutor · error · HTTPException

Failed to add to category

Error message

Failed to add to category

What it means

Error "Failed to add to category" thrown in HKUDS/DeepTutor.

Source

Thrown at deeptutor/api/routers/question_notebook.py:332

        payload.entry_ids, payload.category_id, link=payload.link
    )
    return {
        "changed": changed,
        "requested": len(payload.entry_ids),
        "category_id": payload.category_id,
        "link": payload.link,
    }


@router.post("/entries/{entry_id}/categories")
async def add_entry_to_category(entry_id: int, payload: CategoryAddRequest):
    store = get_sqlite_session_store()
    entry = await store.get_notebook_entry(entry_id)
    if entry is None:
        raise HTTPException(status_code=404, detail="Entry not found")
    ok = await store.add_entry_to_category(entry_id, payload.category_id)
    if not ok:
        raise HTTPException(status_code=400, detail="Failed to add to category")
    return {"added": True, "entry_id": entry_id, "category_id": payload.category_id}


@router.delete("/entries/{entry_id}/categories/{category_id}")
async def remove_entry_from_category(entry_id: int, category_id: int):
    store = get_sqlite_session_store()
    removed = await store.remove_entry_from_category(entry_id, category_id)
    if not removed:
        raise HTTPException(status_code=404, detail="Link not found")
    return {"removed": True, "entry_id": entry_id, "category_id": category_id}


# ── Overview ─────────────────────────────────────────────────────


@router.get("/stats", response_model=QuestionBankStats)
async def question_bank_stats() -> QuestionBankStats:
    """Counts behind the filter chips; also the agent's one-call overview."""

View on GitHub (pinned to 3e82f13042)

When it happens

Trigger: Thrown at deeptutor/api/routers/question_notebook.py:332 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/1767e165bb0ff81a. Report an issue: GitHub.