# sqlalchemy.exc.AmbiguousForeignKeysError: Could not determine join condition between parent/child tables on relationship User.posts - there are multiple foreign key paths linking the tables.

- **ID:** `python/flask-sqlalchemy-ambiguous-foreign-key`
- **Domain:** python
- **Category:** data_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Multiple foreign keys between two tables leave SQLAlchemy unable to infer which FK the relationship uses.

## Version Compatibility

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

## Workarounds

1. **** (95% success)
   ```
   posts = relationship('Post', foreign_keys='Post.author_id')
   ```
2. **** (90% success)
   ```
   posts = relationship('Post', primaryjoin='User.id == Post.author_id')
   ```

## Dead Ends

- **** — Breaks the data model that intentionally needs both. (90% fail)
- **** — Does not resolve join ambiguity. (85% fail)
