HKUDS/DeepTutor · error · HTTPException

unknown run_id

Error message

unknown run_id

What it means

HTTP 404 returned by GET /memory/runs/{run_id} when the run manager has no run registered under the given run_id. Run records live in an in-process manager, so IDs are only resolvable in the process that created them.

Source

Thrown at deeptutor/api/routers/memory.py:359

                "budget": req.budget,
                "iterations": req.iterations,
                "language": req.language,
                "llm_selection": selection,
            },
            language=req.language,
        )
    except RunBusyError as exc:
        raise HTTPException(status_code=409, detail=str(exc))
    return run.to_dict()


@router.get("/runs/{run_id}")
async def get_run(run_id: str):
    from deeptutor.services.memory.consolidator.runs import get_run_manager

    run = get_run_manager().get(run_id)
    if run is None:
        raise HTTPException(status_code=404, detail="unknown run_id")
    return run.to_dict()


@router.post("/runs/{run_id}/cancel")
async def cancel_run(run_id: str):
    from deeptutor.services.memory.consolidator.runs import get_run_manager

    ok = await get_run_manager().cancel(run_id)
    if not ok:
        raise HTTPException(status_code=409, detail="not active")
    return {"run_id": run_id, "cancelled": True}


@router.post("/runs/{run_id}/undo")
async def undo_run_edit(run_id: str):
    from deeptutor.services.memory.consolidator.runs import (
        RunBusyError,
        get_run_manager,

View on GitHub (pinned to 3e82f13042)

Solutions

  1. Verify the run_id matches the value returned by the start endpoint exactly
  2. Check whether the API server restarted — after a restart, list runs or start a new one instead of polling old IDs
  3. If polling long-running runs across restarts matters, persist run metadata externally or re-issue the consolidation
Defensive patterns

Strategy: validation

Validate before calling

const res = await fetch(`/memory/runs/${runId}`);
if (res.status === 404) { /* re-list runs or start a new one */ }

Type guard

function isRunId(id: string): boolean { return /^[A-Za-z0-9_-]+$/.test(id); }

Try / catch

try { const run = await getRun(id); } catch (e) { if (e.status === 404) handleStaleRun(id); else throw e; }

Prevention

When it happens

Trigger: GET /runs/{run_id} with a typo'd ID, an ID from a previous server process (lost on restart), or a run that was completed and evicted from the manager's registry.

Common situations: Server restarts between starting a run and polling it, stale run IDs persisted in client state or logs, or URL-encoding issues mangling the ID in transit.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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