The city of Oakland knew for nearly two decades that the “Ghost Ship” warehouse was a death trap — with at least 10 complaints being recorded against the artist enclave since 1997, a report said Monday night.

County records obtained by NBC News show that the site has been on the radar of local regulators for years and that a habitability probe was still pending when the two-story, 86-year-old building went up in flames on Friday night, killing at least 36 people.

Investigators were trying to confirm a report of an “illegal interior building structure” at the time, which had been filed just last month, according to the records.

The habitability complaints first began rolling in on July 27, 1998 — less than a year after the property was purchased by Chor Ng and his family.

The city initially received reports of tall, overgrown weeds, which were never resolved and remain open to this day, NBC reported.

At least nine other complaints were filed over the years with the Planning and Building Department and the now-dissolved Oakland Community and Economic Development Agency.

Two were filed in March and April 2007, labeling the site “a nuisance or substandard or hazardous or injurious,” the records said.

In June 2014, a new complaint came in saying the site was cluttered with trash and construction debris. The case eventually was “escalated” to a verified violation after the Ng family failed to respond, according to NBC.

The Oakland and Alameda County records show that the complaint was documented as being “abated” or resolved in an undisclosed way by October of that year.

Authorities have launched a criminal investigation into the fire to determine whether there was any wrongdoing that may have led to the tragedy.

The probe into the “illegal interior building structure” that was pending at the time of the fire was filed on Nov. 13, records show.

Darin Ranelletti, interim director of the Planning and Building Department, told NBC that an inspector attempted to enter the Ghost Ship warehouse to assess the site, but “at times” was “not able to secure access to the building.”

A notice of violation wound up being sent out on Nov. 21 — just 12 days before the deadly inferno, according to county records.

It is unclear whether the Ng family or building managers Derick Ion Almena, 46, and wife Micah Allison, 40, ever received the notice.

Noel Gallo, an Oakland City Council member who represents the Ghost Ship’s neighborhood, told NBC he feels the fire was ultimately “preventable.”

“I am not going to make excuses for the city, because we have documented it, we have turned it in, we have called it in,” he said of the numerous complaints over the warehouse.

“I have brought, personally, the police in front of it to shut that place down and to get them to remove that debris,” he said. “For young people and anyone else to lose their lives that way — it was preventable.”