At the heart of last weekend’s tragic Oakland warehouse fire is a simple truth: People failed. And now, 36 young people are dead.

Wednesday, another likely preventable horror unfolded in the Bronx, where two infant girls in a city-funded apartment for homeless families died of burns caused by steam from a radiator valve that blew off. The building, owned by a notorious slumlord, has dozens of open violations. The cluster-site housing was run by a nonprofit organization flagged for an unsafe operation in another Bronx building last year.

As in California, it is likely that some people failed to do their jobs. Others failed to follow regulations. The real tragedy is that both were utterly avoidable.

The eerily nicknamed Ghost Ship warehouse, home to an enclave of California artists, was the source of many complaints to city agencies. But officials never shut it down. An inspector investigating two weeks before the fire said he couldn’t get inside. He never returned.

The warren of crammed living spaces and electrical jerry-rigging had no permits or inspections and no sign of sprinklers or smoke alarms. The only way to the second floor — where a dance party was underway when the fire broke out — was a makeshift stairway of wood pallets quickly destroyed by the blaze, trapping revelers.

Urban artists squeezed by rising rents have been turning commercial buildings into spaces for living and working for decades. And Oakland wasn’t the first fatal fire in a nightclub or concert venue that had code violations, a lack of permits or problematic exits. Some NYC residents remember the Bronx arson fire in the unlicensed Happy Land social club that killed 87 people in 1990.

It’s easy to grumble about too many regulations and too much code enforcement, but the fire in Oakland underscores the importance of getting those right. That’s true for rundown warehouses, social clubs or homeless shelters.

All of us play a part by making sure there are ways to get out of the places we go. But the past few days make clear that safety begins with building owners following rules and officials doing their jobs.