Sample data, not from a customer
This is what Bugsly shows when your app throws
A hand-written example of one captured error in a FastAPI service: the stack trace with the failing line, the steps that led up to it, the release and environment, and a plain-English cause with a suggested fix. Nothing on this page is live: no AI call is made and no signup is needed.
AttributeError: 'NoneType' object has no attribute 'email'
GET /api/v1/orders/{order_id}/summary · app/api/orders.py in get_order_summary
Stack trace
AttributeError: 'NoneType' object has no attribute 'email'
37async def get_order_summary(order_id: int, db: AsyncSession = Depends(get_db)):38order = await db.get(Order, order_id, options=[selectinload(Order.customer)])39if order is None:40raise HTTPException(status_code=404, detail="Order not found")41return {"id": order.id, "owner": order.customer.email, "total": order.total}
The frame in your own code (“in app”) is expanded first; library frames are collapsed.
Breadcrumbs
- httpPOST /api/v1/checkout 20009:14:02 UTC
- consoleorder 8812 created for guest checkout (customer_id=NULL)09:14:02 UTC
- httpGET /api/v1/orders/8812/summary09:14:09 UTC
- consoleSELECT orders.* FROM orders WHERE orders.id = 881209:14:09 UTC
- consoleAttributeError: 'NoneType' object has no attribute 'email'09:14:09 UTC
AI analysis
Example output, pre-written. Not generated live.
What it means
The code read .email on order.customer, but order.customer is None, so Python can't look up an attribute on it.
Likely cause
In get_order_summary (orders.py:41) the order was loaded fine, but its customer relationship is empty. That usually means the order's customer_id is NULL or points at a customer row that was deleted (for example a guest checkout or a soft-deleted account), so the ORM returns None instead of a Customer.
Suggested fix
Decide what a customer-less order should return, then handle it explicitly:
owner = order.customer.email if order.customer else None
return {"id": order.id, "owner": owner, "total": order.total}
If every order must have a customer, fix the data (or add a NOT NULL foreign key) instead of hiding the None.Tags
Tags and release come from your SDK config.
Get this for your own app
The free plan includes 100 issues per month, 7-day retention, 1 user, 10 AI analyses per month.
Sign up for the free planTry it on your own stack trace
Paste an error into the free explainer to get the same kind of plain-English answer. No signup.
Explain my error