TypeError: unhashable type: 'list'
A mutable object (list, dict, set) was used as a dict key or set member.
Seen on:
Python
Meaning
Dict keys and set members must be hashable (immutable). Convert lists to tuples, or use a different key.
Common causes
- Using a list as a dict key
- Adding dicts to a set
- groupby/drop_duplicates on columns containing lists (pandas)
⚡ Quick fix
- Convert to tuple: d[tuple(key)]
- Use frozenset for set-of-sets
- Serialize to a string key if needed
Detailed fix by platform
Python
seen = {tuple(row) for row in rows}
How to diagnose
- Type — Which type is unhashable?
- Usage — Key, set member, or pandas operation?
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026