# sqlalchemy.orm.exc.NoResultFound: No row was found for one()

- **ID:** `python/sqlalchemy-orm-exc-no-result-found`
- **Domain:** python
- **Category:** data_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Using .one() method when the query returns no rows, which expects exactly one result.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.x | active | — | — |

## Workarounds

1. **Use one_or_none() with None check** (95% success)
   ```
   Use .one_or_none() and handle None explicitly, e.g., user = session.query(User).filter_by(id=1).one_or_none().
   ```
2. **Use first() method** (85% success)
   ```
   Use .first() if only the first result is needed, but be aware of potential multiple rows.
   ```

## Dead Ends

- **Using scalar() instead** —  (60% fail)
- **Assuming default value exists** —  (50% fail)
