# RuntimeError: The session is unavailable because no secret key was set.  Set the secret_key on the application to something unique and secret.

- **ID:** `python/flask-secret-key-missing`
- **Domain:** python
- **Category:** config_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Flask's session cookie signing requires app.secret_key, but it was never configured before using session or flash.

## Version Compatibility

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

## Workarounds

1. **** (95% success)
   ```
   app.config['SECRET_KEY'] = os.environ['SECRET_KEY']
   ```
2. **** (90% success)
   ```
   app.secret_key = secrets.token_hex(32) for dev only
   ```

## Dead Ends

- **** — Flask treats empty string as falsy and raises the same error. (90% fail)
- **** — No such option; sessions still require a key. (85% fail)
