{"record":{"id":"d06cb5eddb2d9b36","repo":"lfnovo/open-notebook","slug":"error-fetching-transformation-str-e","errorCode":null,"errorMessage":"Error fetching transformation: {str(e)}","messagePattern":"Error fetching transformation: (.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"api/routers/transformations.py","lineNumber":202,"sourceCode":"\n@router.get(\n    \"/transformations/{transformation_id}\", response_model=TransformationResponse\n)\nasync def get_transformation(transformation_id: str):\n    \"\"\"Get a specific transformation by ID.\"\"\"\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        return _transformation_response(transformation)\n    except HTTPException:\n        raise\n    except OpenNotebookError:\n        raise\n    except Exception as e:\n        logger.error(f\"Error fetching transformation {transformation_id}: {str(e)}\")\n        raise HTTPException(\n            status_code=500, detail=f\"Error fetching transformation: {str(e)}\"\n        )\n\n\n@router.put(\n    \"/transformations/{transformation_id}\", response_model=TransformationResponse\n)\nasync def update_transformation(\n    transformation_id: str, transformation_update: TransformationUpdate\n):\n    \"\"\"Update 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        # Update only provided fields\n        if transformation_update.name is not None:","sourceCodeStart":184,"sourceCodeEnd":220,"githubUrl":"https://github.com/lfnovo/open-notebook/blob/a7de90d38aaf18ee85fd661854d35c11e44613e2/api/routers/transformations.py#L184-L220","documentation":"Generic 500 from GET /transformations/{transformation_id} when fetching the record raises an unexpected exception (i.e. not the clean not-found case). Typically a SurrealDB query error or record deserialization problem inside Transformation.get.","triggerScenarios":"GET /api/transformations/{id} with a malformed record ID that crashes the SurrealDB query parser, or while the database connection has dropped.","commonSituations":"Passing a raw ID without the record prefix, a SurrealDB restart mid-session, or version drift between the model class and stored records.","solutions":["Check API logs for the underlying exception message","Confirm the ID format matches existing transformation IDs (compare with GET /transformations output)","Verify SurrealDB is reachable and restart the API if the connection pool went stale"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"def looks_like_record_id(rid: str) -> bool:\n    return bool(rid) and ':' in rid","typeGuard":null,"tryCatchPattern":"resp = await client.get(f'/transformations/{tid}')\nif resp.status_code == 500:\n    logger.error('fetch failed', resp.json().get('detail'))\n    # verify DB health before retrying\nif resp.status_code == 404:\n    ...  # genuine not-found","preventionTips":["Use full record IDs (table:id) as returned by the API","Distinguish 404 (bad ID) from 500 (infrastructure) in error handling","Check API logs for the root exception"],"tags":["fastapi","http-500","transformation","surrealdb"],"backgroundTag":"database-query-failed","analyzedSha":"a7de90d38aaf18ee85fd661854d35c11e44613e2","analyzedAt":"2026-08-27T02:39:58.166Z","schemaVersion":2},"datasetVersion":"2026-08-27T03:17:27.898Z"}