{"record":{"id":"abece2773077e21d","repo":"lfnovo/open-notebook","slug":"failed-to-get-rebuild-status-str-e","errorCode":null,"errorMessage":"Failed to get rebuild status: {str(e)}","messagePattern":"Failed to get rebuild status: (.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"api/routers/embedding_rebuild.py","lineNumber":197,"sourceCode":"\n        # Add error message if failed\n        if (\n            status.status == \"failed\"\n            and status.result\n            and isinstance(status.result, dict)\n        ):\n            response.error_message = status.result.get(\"error_message\", \"Unknown error\")\n\n        return response\n\n    except HTTPException:\n        raise\n    except OpenNotebookError:\n        raise\n    except Exception as e:\n        logger.error(f\"Failed to get rebuild status: {e}\")\n        logger.exception(e)\n        raise HTTPException(\n            status_code=500, detail=f\"Failed to get rebuild status: {str(e)}\"\n        )\n","sourceCodeStart":179,"sourceCodeEnd":200,"githubUrl":"https://github.com/lfnovo/open-notebook/blob/a7de90d38aaf18ee85fd661854d35c11e44613e2/api/routers/embedding_rebuild.py#L179-L200","documentation":"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.","triggerScenarios":"SurrealDB connection failure or timeout inside get_command_status; malformed status payload breaking RebuildStatusResponse construction; serialization errors on unexpected status values.","commonSituations":"Database down or restarted mid-poll, network blips between API and SurrealDB, schema drift after a migration where the command record shape changed.","solutions":["Check API logs — logger.exception(e) prints the underlying traceback; fix that root cause","Verify SurrealDB is up (make database) and the API can reach it","Retry the status poll after transient DB issues resolve","If RebuildStatusResponse validation fails, reconcile the command record's fields with the response model"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"for attempt in range(3):\n    try:\n        return await client.get(f\"/api/embedding_rebuild/{command_id}/status\")\n    except httpx.HTTPStatusError as e:\n        if e.response.status_code >= 500 and attempt < 2:\n            await asyncio.sleep(2 ** attempt)\n            continue\n        raise","preventionTips":["Monitor SurrealDB availability — most 500s here are DB connectivity","Watch API logs; logger.exception captures the true root cause","Add timeouts on status polling so hung DB calls don't pile up"],"tags":["http-500","internal-error","surreal-db","embedding-rebuild"],"backgroundTag":"internal-server-error","analyzedSha":"a7de90d38aaf18ee85fd661854d35c11e44613e2","analyzedAt":"2026-08-27T02:39:58.166Z","schemaVersion":2},"datasetVersion":"2026-08-27T03:17:27.898Z"}