lfnovo/open-notebook · error · HTTPException

Failed to fetch job status

Error message

Failed to fetch job status

What it means

500 from GET /commands/jobs/{job_id} when querying job status throws an unexpected exception (not a mapped NotFound/OpenNotebook error). Logged as 'Error fetching job status: ...'.

Source

Thrown at api/routers/commands.py:94

        raise HTTPException(
            status_code=500, detail="Failed to submit command"
        )


@router.get("/commands/jobs/{job_id}", response_model=CommandJobStatusResponse)
async def get_command_job_status(job_id: str):
    """Get the status of a specific command job"""
    try:
        status_data = await CommandService.get_command_status(job_id)
        return CommandJobStatusResponse(**status_data)

    except HTTPException:
        raise
    except OpenNotebookError:
        raise
    except Exception as e:
        logger.error(f"Error fetching job status: {str(e)}")
        raise HTTPException(
            status_code=500, detail="Failed to fetch job status"
        )


@router.get("/commands/jobs", response_model=List[Dict[str, Any]])
async def list_command_jobs(
    command_filter: Optional[str] = Query(None, description="Filter by command name"),
    status_filter: Optional[str] = Query(None, description="Filter by status"),
    limit: int = Query(50, description="Maximum number of jobs to return"),
):
    """List command jobs with optional filtering"""
    try:
        jobs = await CommandService.list_command_jobs(
            command_filter=command_filter, status_filter=status_filter, limit=limit
        )
        return jobs

    except HTTPException:

View on GitHub (pinned to a7de90d38a)

Solutions

  1. Check the API log for the underlying exception
  2. Confirm SurrealDB and worker are running
  3. If the job truly vanished, resubmit the command instead of polling the old job id
Defensive patterns

Strategy: try-catch

Try / catch

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

Prevention

When it happens

Trigger: Job store unreadable, connection failure to SurrealDB, or job record with a shape the status parser can't handle.

Common situations: SurrealDB restarted losing in-memory/job state; querying a job id from a wiped DB; version mismatch between job records and current parser.

Related errors


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