OAKLAND — The city has been hit with another lawsuit stemming from a fatal fire, this time the March 2017 blaze that killed four people in a halfway house less than four months after the deadly Ghost Ship inferno.

Oakland is already facing a suit for that Dec. 2, 2016 fire, in which 36 people attending an electronic dance party in the Fruitvale neighborhood warehouse perished.

Surviving tenants and families of victims who lived at 2551 San Pablo Ave. originally filed suit in April 2017 against building owner Keith Kim and a nonprofit agency that provided services there. The city was added to the list of defendants in a master complaint filed last month in Alameda County Superior Court.

“These people were plunged into darkness and thick, black smoke and tried to exit the unsafe structure,” according to the lawsuit. “The interior of the three-story, 43-unit building was a known fire hazard which was cluttered with storage, debris, discarded furniture and open piles of garbage.”

The San Pablo Avenue fire, coming on the heels of Ghost Ship, exposed deep flaws in Oakland’s fire inspection system and raised questions about whether the city could achieve the core government purpose of keeping people safe.

In 2015, a firefighter called to the halfway house checked a referral box in the department’s inspection database, thinking it would alert an inspector in the Fire Prevention Bureau to visit the building. But the referral alert didn’t work and no inspectors visited the building for another 15 months.

Still, there was a chance to save lives. An inspector found a series of safety problems in the building three days before the fatal blaze, writing in an email “this building is dangerous!” But it wasn’t red tagged and an option available to the fire department that would have required the building owner to place a guard on “fire watch” as a lookout for dangers, wasn’t taken.

The Bay Area News Group reported in July that the referral problem was widespread across the city, with 80% of referrals of apartment buildings housing thousands of people never acted on over a seven-year period. Ten fires broke out at commercial buildings after an inspection referral was entered in the system but before an inspection was performed.

At least 20 complaints for hazardous and unsafe conditions at the San Pablo Avenue building since 2007 were filed with the Oakland Planning and Building Department, including a request for an inspection by the master tenant about three weeks before the fatal fire, according to the lawsuit.

A spokesman for City Attorney’s Office, declined comment, saying he can’t discuss an active lawsuit. Seven law firms are representing dozens of plaintiffs in the San Pablo Avenue fire lawsuit, including the law firm of Mary Alexander, who is the lead attorney on the Ghost Ship lawsuit.

In November, an Alameda County Superior Court judge ruled Oakland had a “mandatory duty” to ensure safety at the Ghost Ship warehouse. The tentative ruling pierced through broad immunities protecting California cities from civil lawsuits to protect workers who either botched inspections of a building or failed to perform the inspection at all.