Retaining walls are subject to the usual liabilities of home ownership. For example, if your patio sits atop a large retaining wall and someone falls off and injures themselves, you could be liable for those injuries (you should have installed a railing).
Where it gets complicated, though, is when neighbouring properties get involved.
If your retaining wall collapses and causes damage to a neighbouring property, you could be held liable for that damage, too (or the contractor that built the wall, if faulty construction is to blame).
Issues also arise with retaining walls that straddle property lines. Typically, whoever has the wall on their side of the property line is responsible for any liability issues. But, sometimes, a retaining wall on one property is actually holding earth belonging to the neighbouring property.
Disputes over retaining walls often wind up in court.
If you’re building a new one anywhere near your neighbour’s property, make sure you’ve crossed your t’s and dotted your i’s: get your building permits, make an agreement with your neighbour, and get the property line surveyed.