Homeowners near Wellington are reporting their local council losing the paperwork for their houses.
They say they've been bought to tears, have had to fight to get by, and have been left wondering how widespread the problem might be nationwide.
Sue Mortimer can't sell her sunny home on a bush-clad hillside with a glimpse of Plimmerton Beach to move into a granny flat at her son's place in Karori.
She needs to - having had to retire - but said final approval of the work done to create a small downstairs bedroom in 1999 was missing at the Porirua City Council.
"We had all the consents, we had all the inspections done, we got code of compliance, I applied for it. And then discovered years later that actually I didn't have code of compliance at all, there was no record of it at council," Mortimer said.
The council told her in 2005 it had sorted out the paperwork, but it had not, she said.
"It came as a complete shock."
Not having a code compliance certificate is a barrier to getting a mortgage or insurance for a would-be buyer.
Mortimer must now hire a building surveyor and engineer.
"With what? I'm selling the house to pay off what I need to pay off so that I can live. Now I'm stuck with a house that's actually going to add to my debt.
"I actually don't have a way out."
She had cried about it and felt desperate, but also galvanised. So she posted about her dilemma online.
"My feeling is this is much, much bigger than just me - and, boy, was I right. I was inundated with calls all weekend, some of them lasting an hour or more, of people very, very distressed.
"Even people who have actually already sorted it out and have now got code compliance, or in some cases they've just sold at a loss.
"Because there's a lot of people out there who are living in houses and they think they're code compliant, and they're not.
"And the other issue now is, if, for example, I had a fire in this part of the house, my insurance company might not cover me because I've not notified them that I'm not code compliant."
Fifteen people contacted her online.
They painted a picture of historical council record-keeping failures now coming home to roost for them.
One, a woman who RNZ agreed not to name, bought in Whitby in 2005.
In 2014 she went to sell, only to find that vital documentation - a certificate of acceptance (similar to a code compliance certificate) which she knew was completed - was not on file.
The family was faced with having to go to the Ministry of Business, Innovation and Employment to get a determination against the council, but with no guarantee it would rule in their favour or what it would cost.
Instead, they paid builders to rip walls off their house to prove it was up to scratch.
"We probably lost close to $100,000," the woman said.
"But at least we were able to sell in the end. What really upset us was it was really clear from all the information we had [it was compliant], but the council weren't prepared to work with us."
A bad patch?
Mortimer believed Porirua went through a particularly bad patch in the decade or so after 1995 where "records have gone missing" and that standards had improved since.
However, the latest survey of all councils' building teams by International Accreditation New Zealand (IANZ) showed that all of the top five breaches were in the area covering what councils told people about their buildings, their information processing, and how consenting and inspections were done.
For councils, the clock was always ticking once a building consent was granted, with at least part of the onus on the council.
Porirua City Council's website said: "Although there is no imposed timeframe on an owner to complete work, on the two-year anniversary of the granting of your consent, we are required to decide if a code compliance certificate can be issued.
"If a code compliance certificate cannot be issued, we will write to you detailing the additional information you need to supply."
Lisa Dymond bought in rural Porirua in 2013.
She got a code compliance certificate after a struggle, but had found her permits mixed up with her neighbour's, despite the city council promising her years ago it was sorted.
"So if I want to make changes to my garage I'll have to get them to get the right building put back onto my property and the wrong one put back on to the other," Dymond said.
"Same with the fireplaces and things. My previous job before I was a part-time farmer was process and documentation management so I find it appalling that there's no records updated or nothing on file."
RNZ has been told of missing files to do with cross leases - and at other councils.
Dealing with council
A year ago, mechanic Jos Westerbeek went to sell the Porirua home he bought in 2010. He found out he had no code compliance certificate.
"That information was not on my first LIM [Land Information Memorandum] report," Westerbeek said.
"I saw all the paperwork that the inspector signed off for all sorts of things. I never saw that piece of paper, they never told me.
"When you go to city council, you ask for all the information, they should supply you with everything."
Westerbeek advised any house buyer anywhere to eyeball their council and get it in writing that their house was okay.
"So basically if something happens afterwards, you've got a stick to hit with."
He had spent more than $5000 on a surveyor and other fees and a year wrangling with the council even as he tried to get the paperwork he needed for a sale.
"This is mission impossible. The big problem is city council doesn't like surveyors, surveyors don't like city councils, and it drags on and drags on," he said.
Another homeowner, who RNZ agreed not to identify, said they almost went bankrupt fighting Porirua City Council over its building consent processes for a house they ended up selling at a loss.
They said the council's attitude was it was "their way or the highway", knowing that legal costs - and exhaustion - would deter most homeowners from battling further.
The Ministry of Business, Innovation and Employment - the central building regulator that oversees council functions - said if homeowners had concerns about code compliance certificates they should go back to their council.
As for IANZ's accreditation assessment that found a lot of council non-compliance, the ministry said it "does not indicate that there are issues with the code compliance certificates".
It said nothing about councils failing to issue the certificates at all, or losing them.
Mortimer questioned why home owners had to pay for council mistakes.
"It doesn't seem right to me that having done everything right in the past, I've been let down twice by somebody who was working at a time when, quite frankly, some of the inspectors - not all of them - but some of the inspectors were really not up to the job or they had different requirements in those days."
The Porirua City Council declined to be interviewed.
But it said in a statement the issuing of a code compliance certificate was the home owner's responsibility but it would work with them pragmatically if there were problems.
"We are often contacted by owners who think that their builders obtained their CCC years earlier but are shocked to learn that a code compliance certificate was never requested nor issued," it said.
"When this happens we take a pragmatic approach and do our best to help the owners by providing them with a compliance path."
Its processes and building records were robust, it said.
It mentioned the two-year trigger that required councils to make a decision about a code compliance certificate, but did not say if it contacted Porirua homeowners about this as a matter of course.