odysseus-dev/odysseus · error · HTTPException

Task is not running

Error message

Task is not running

What it means

Error "Task is not running" thrown in odysseus-dev/odysseus.

Source

Thrown at routes/task_routes.py:889

        if not started:
            raise HTTPException(409, "Task is already running")
        return {"ok": True, "message": "Task triggered" + (" in parallel" if force else "")}

    @router.post("/{task_id}/stop")
    async def stop_task_now(request: Request, task_id: str):
        user = _owner(request)
        db = SessionLocal()
        try:
            task = db.query(ScheduledTask).filter(ScheduledTask.id == task_id).first()
            if not task:
                raise HTTPException(404, "Task not found")
            if user and task.owner != user:
                raise HTTPException(403, "Access denied")
        finally:
            db.close()
        stopped = await task_scheduler.stop_task(task_id)
        if not stopped:
            raise HTTPException(404, "Task is not running")
        return {"ok": True, "message": "Task stopped"}

    @router.get("/runs/recent")
    async def list_recent_runs(request: Request, limit: int = 50, max_result_chars: int = 6000):
        """Recent task runs across ALL tasks for this owner. Drives the Activity view."""
        user = _owner(request)
        limit = max(1, min(limit, 200))
        max_result_chars = max(500, min(max_result_chars, 20000))
        db = SessionLocal()
        try:
            q = db.query(TaskRun, ScheduledTask).join(
                ScheduledTask, TaskRun.task_id == ScheduledTask.id
            )
            if user:
                # Strict owner scope — was previously OR'ing in `owner IS NULL`
                # rows for "legacy single-user" back-compat, but that leaks any
                # legacy/migrated task's full result text to every authenticated
                # user. _migrate_assign_legacy_owner runs on startup to claim

View on GitHub (pinned to f9235ebbf1)

Solutions

  1. Start the task before trying to stop it.
  2. Refresh the task list; its state may have changed.

When it happens

Trigger: Triggered when the corresponding server-side validation or runtime check at the recorded location rejects the request or operation and returns this error message to the caller.

Common situations: See trigger scenarios.


AI-assisted analysis of odysseus-dev/odysseus@f9235ebbf1 (2026-08-14). Data as JSON: /api/errors/f466d78c48ac45ab. Report an issue: GitHub.