Azure Functions runtime throws an "Insufficient memory to continue the execution of the program." error. What do?

How to resolve error “Insufficient memory to continue the execution of the program.” when debugging Azure Functions locally?

This post was most recently updated on February 5th, 2021.

2 min read.

This article describes a solution to an error “Insufficient memory to continue the execution of the program.” I was debugging an Azure Function locally and ran into it – it stopped my Azure Function from starting at all.

So, this is what I got:

Insufficient memory to continue the execution of the program.

Ohh… kay..? My development machines have plenty of RAM, surely enough to run an Azure Function!

Hell, I’m sure I have enough memory to have Google Chrome running while debugging a pesky Azure Function. So what gives?

How to resolve the error?

Okay, okay. So it’s actually super simple and the error is just misleading.

Not the first time that’s the case, right? :)

Anyway, chances are that you have empty values in your local.settings.json file. Something like shown below:

Empty values in appsettings.json file. That's a problem!
Empty values in local.settings.json or appsettings.json file. That’s a problem!

This’ll throw Azure Functions runtime off. Weirdly, this seems to have been fixed in 2019 and merged in DEV branch of Azure Functions runtime in February 2020 – but it seems to still occur with current version.

Just make sure you only have entries with at least the key set up!

And hey – if you have an application setting with an empty key (but the value set), you’ll get an error like this:

"String cannot be of zero length. (Parameter 'variable')" when running your Azure Functions - that's ALSO a problem, but at least it's a better error message!
“String cannot be of zero length. (Parameter ‘variable’)” when running your Azure Functions – that’s ALSO a problem, but at least it’s a better error message!

Just for the record, here’s the error once more:

String cannot be of zero length. (Parameter 'variable')

Just fill the key for your application setting entries!


With that, you should be good! :)

References

mm
4.5 2 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments