The problem was Immigration, after spending $914,000 in the first half of the financial year, only had $363,868 to last until the end of June.
The total deportations budget was $1.2 million for the 2017/18 year, a significant cut from $1.7m the previous year.
The blowout led to a flurry of emails between senior managers, released to the Herald under the Official Information Act, on how to handle the crisis.
Staff were told no one was to be deported unless the illegal migrants met strict criteria.
"Should we locate [redacted target] as Shandy suggested we will have a whip around and run a couple of raffles," investigator David Yandall joked in an email about the orders.
"I know this may have some negative effect on how we do things, but I still believe we can conduct quality investigations without using the authority to deport."
Money was so tight, one investigator who asked for $500 to deport someone who had been living here for 14 years - "this is a case of flagrant disregard of immigration law" - was rejected.
The emails also reveal frustration in management about how the budget cut forced the freeze on deportations.
Alistair Murray, a senior manager in Auckland, queried why the budget was $1.2m when they had spent nearly $1.8m the previous year, and $1.6m the year before that.
His boss, Pete Devoy the assistant general manager, replied: "I can only [hazard] a guess but I would expect that is is viewed as an area where the budget can be cut and not have a visible impact on INZ's business."
The previous annual costs of nearly $1.8m and $1.6m had also blown the budget, but were funded from "underspends" in other parts of the government agency.
Dave Campbell, another senior manager under Devoy, said the budget needed to be higher in the next financial year.
"The reality is that our people are targeting high harm deportations that are costing us money.
"Telling them now to not target custodial deportations is going to quickly erode morale and engagement.
"The impact we have been having particularly in the Bay of Plenty with the unlawful Indian population will quickly revert once we reduce our activity."
Instead of finding and deporting illegal migrants, compliance staff were told to focus on "voluntary departures" - where overstayers are asked to leave at their own expense - debt recovery, and serving deportation papers.
In a memo to his supervisor Nicola Hogg, Devoy outlined the costs, issues and risks in a bid for more funding as the budget for the rest of the 2017/18 financial year "may be insufficient to deport even the highest priority individuals".
Part of the problem was airlines demanding more security - up to three escorts - and deportations to more expensive parts of the world to travel, such as Africa and the Middle East.
Devoy said the budget shortfall posed several risks to Immigration New Zealand's reputation "in particular for those migrants who are considered the highest harm".
Several months of uncertainty ended in March when Hogg was successful in seeking an extra $500,000 in the budget for the rest of the financial year.
"This means that staff can continue their deportation activities as usual," said Hogg by email.
One of the investigators quickly replied to Hogg to thank her for the good news.
"Thank you so much for this news. The morale has been at an all-time low."
Cost of deportations
• 2012/13 - 791 deportations cost $1,532,091
• 2013/14 - 660 deportations cost $1,229,294
• 2014/15 - 523 deportations cost $1,317,707
• 2015/16 - 529 deportations cost $1,611,130
• 2016/17 - 727 deportations cost $1,778,196
• 2017/18 - INZ had budget of $1,278,000 but spent $914,000 by January. Only had $363,868 to last until the end of June. Received an extra $500,000.