# AssertionError: View function mapping is overwriting an existing endpoint function: main

- **ID:** `python/flask-assertionerror-view-function-mapping`
- **Domain:** python
- **Category:** config_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Two different view functions are registered with the same endpoint name or route.

## Version Compatibility

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

## Workarounds

1. **Use unique endpoint names** (95% success)
   ```
   @app.route('/home', endpoint='home')
def home():
    return 'Home'
@app.route('/main', endpoint='main')
def main():
    return 'Main'
   ```
2. **Combine routes with different methods** (90% success)
   ```
   @app.route('/data', methods=['GET'])
def get_data():
    return 'GET'
@app.route('/data', methods=['POST'])
def post_data():
    return 'POST'
   ```

## Dead Ends

- **Changing function name without changing endpoint** — Flask uses endpoint, not function name, for uniqueness. (70% fail)
- **Using same route for GET and POST without specifying methods** — Can cause conflict if both are same function. (60% fail)
