{"record":{"id":"ce14549ace184ac7","repo":"lfnovo/open-notebook","slug":"error-deleting-transformation-str-e","errorCode":null,"errorMessage":"Error deleting transformation: {str(e)}","messagePattern":"Error deleting transformation: (.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"api/routers/transformations.py","lineNumber":271,"sourceCode":"\n@router.delete(\"/transformations/{transformation_id}\")\nasync def delete_transformation(transformation_id: str):\n    \"\"\"Delete a transformation.\"\"\"\n    try:\n        transformation = await Transformation.get(transformation_id)\n        if not transformation:\n            raise HTTPException(status_code=404, detail=\"Transformation not found\")\n\n        await transformation.delete()\n\n        return {\"message\": \"Transformation deleted successfully\"}\n    except HTTPException:\n        raise\n    except OpenNotebookError:\n        raise\n    except Exception as e:\n        logger.error(f\"Error deleting transformation {transformation_id}: {str(e)}\")\n        raise HTTPException(\n            status_code=500, detail=f\"Error deleting transformation: {str(e)}\"\n        )\n","sourceCodeStart":253,"sourceCodeEnd":274,"githubUrl":"https://github.com/lfnovo/open-notebook/blob/a7de90d38aaf18ee85fd661854d35c11e44613e2/api/routers/transformations.py#L253-L274","documentation":"Generic 500 from DELETE /transformations/{transformation_id} when transformation.delete() raises an unexpected exception. The record was found, so the failure is in the delete operation itself — typically SurrealDB connectivity or referential data problems.","triggerScenarios":"DELETE while SurrealDB drops the connection, or when deleting cascades into related records and one of those operations fails.","commonSituations":"Database restart mid-request, network blips between API and SurrealDB, or partial corruption in related records.","solutions":["Check API logs for the underlying exception message","Verify database connectivity, then retry the DELETE","If it keeps failing, inspect the transformation and related records directly in SurrealDB"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"resp = await client.delete(f'/transformations/{tid}')\nif resp.status_code >= 500:\n    await asyncio.sleep(2)\n    resp = await client.delete(f'/transformations/{tid}')  # 404 on retry means it was deleted","preventionTips":["Ensure database stability before delete operations","On retry, interpret a subsequent 404 as success","Log the 500 detail for root-cause analysis"],"tags":["fastapi","http-500","transformation","delete","surrealdb"],"backgroundTag":"database-write-failed","analyzedSha":"a7de90d38aaf18ee85fd661854d35c11e44613e2","analyzedAt":"2026-08-27T02:39:58.166Z","schemaVersion":2},"datasetVersion":"2026-08-27T03:17:27.898Z"}