lfnovo/open-notebook · error · HTTPException

Failed to get rebuild status: {str(e)}

Error message

Failed to get rebuild status: {str(e)}

What it means

Generic 500 from the rebuild-status endpoint when an unexpected exception escapes while fetching or building the rebuild status. The original exception is logged with a full traceback before being converted to HTTP 500.

Source

Thrown at api/routers/embedding_rebuild.py:197

        # Add error message if failed
        if (
            status.status == "failed"
            and status.result
            and isinstance(status.result, dict)
        ):
            response.error_message = status.result.get("error_message", "Unknown error")

        return response

    except HTTPException:
        raise
    except OpenNotebookError:
        raise
    except Exception as e:
        logger.error(f"Failed to get rebuild status: {e}")
        logger.exception(e)
        raise HTTPException(
            status_code=500, detail=f"Failed to get rebuild status: {str(e)}"
        )

View on GitHub (pinned to a7de90d38a)

Solutions

  1. Check API logs — logger.exception(e) prints the underlying traceback; fix that root cause
  2. Verify SurrealDB is up (make database) and the API can reach it
  3. Retry the status poll after transient DB issues resolve
  4. If RebuildStatusResponse validation fails, reconcile the command record's fields with the response model
Defensive patterns

Strategy: retry

Try / catch

for attempt in range(3):
    try:
        return await client.get(f"/api/embedding_rebuild/{command_id}/status")
    except httpx.HTTPStatusError as e:
        if e.response.status_code >= 500 and attempt < 2:
            await asyncio.sleep(2 ** attempt)
            continue
        raise

Prevention

When it happens

Trigger: SurrealDB connection failure or timeout inside get_command_status; malformed status payload breaking RebuildStatusResponse construction; serialization errors on unexpected status values.

Common situations: Database down or restarted mid-poll, network blips between API and SurrealDB, schema drift after a migration where the command record shape changed.

Related errors


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