# sqlalchemy.exc.InvalidRequestError: This session is in 'committed' state; no further SQL can be emitted within this transaction.

- **ID:** `python/sqlalchemy-invalid-request-state`
- **Domain:** python
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Attempting to execute SQL queries after committing the session, which closes the transaction.

## Version Compatibility

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

## Workarounds

1. **Create a new session for subsequent operations** (100% success)
   ```
   from sqlalchemy.orm import sessionmaker
Session = sessionmaker(bind=engine)
new_session = Session()
new_session.query(User).all()
   ```
2. **Use session.begin_nested() for savepoints** (95% success)
   ```
   with session.begin_nested():
    session.add(new_user)
session.commit()
   ```

## Dead Ends

- **Calling session.rollback() after commit** — Rollback is not allowed after commit; the transaction is already finalized. (90% fail)
- **Using session.begin() again without a new session** — The session is in a committed state; you need to create a new session or use begin_nested. (85% fail)
