Seconded. Both concepts apply, as is very common.
Attempting to generalize:
A tragedy of the commons is when everyone would be better off if everyone avoided an action which produces more negative externalities than captured value, but each one is individually better off if they take that action, so most do take it.