When my Azure Function doesn't build

How to fix “System.IO.FileSystem: Could not find a part of the path \AppData\Local\AzureFunctionsTools\Releases\3.17.0\workers. Value cannot be null. (Parameter ‘provider’)” when running Azure Functions locally?

This post was most recently updated on September 19th, 2021.

2 min read.

Well, that title is a mouthful. But it’s the topic for today, so what can you do?

That said, this article should be pretty topical, as the issue started popping up only a few days ago. Chances are it’ll be patched soon enough, but in the meantime, it’s always useful to document the fix!

Problem

Table of Contents

When running or debugging Azure Functions locally, your runtime just blurts our this error and fails to compile your functions:

[2021-01-11T10:28:11.495Z] A host error has occurred during startup operation '0d00defa-b8bd-4fb8-9794-b0e5950a4c38'.
[2021-01-11T10:28:11.499Z] System.IO.FileSystem: Could not find a part of the path 'C:\Users\username\AppData\Local\AzureFunctionsTools\Releases\3.17.0\workers'.
Value cannot be null. (Parameter 'provider')
Press any to continue….[2021-01-11T10:28:12.625Z] A host error has occurred during startup operation 'beca4180-a97c-4fab-b3d8-2323dbf5512d'.
[2021-01-11T10:28:12.628Z] System.IO.FileSystem: Could not find a part of the path 'C:\Users\username\AppData\Local\AzureFunctionsTools\Releases\3.17.0\workers'.
[2021-01-11T10:28:14.762Z] A host error has occurred during startup operation '447864ad-026f-462d-9d8d-70f95703baa8'.
[2021-01-11T10:28:14.764Z] System.IO.FileSystem: Could not find a part of the path 'C:\Users\username\AppData\Local\AzureFunctionsTools\Releases\3.17.0\workers'.

And this is what it actually looks like:

"System.IO.FileSystem: Could not find a part of the path \AppData\Local\AzureFunctionsTools\Releases\3.17.0\workers. Value cannot be null. (Parameter 'provider')" getting thrown when running Azure Functions locally.
“System.IO.FileSystem: Could not find a part of the path \AppData\Local\AzureFunctionsTools\Releases\3.17.0\workers. Value cannot be null. (Parameter ‘provider’)” getting thrown when running Azure Functions locally.

What do?

Solution

This one turned out to be easy to fix. Let me show the steps below!

Time needed: 5 minutes.

How to fix “System.IO.FileSystem: Could not find a part of the path \AppData\Local\AzureFunctionsTools\Releases\3.17.0\workers. Value cannot be null. (Parameter ‘provider’)” when running Azure Functions locally?

  1. Copy-paste the path the CLI is complaining about

    That’s going to be something along the lines of:
    ‘C:\Users\your username here\AppData\Local\AzureFunctionsTools\Releases\3.17.0\workers

  2. Remove the last part (workers) and open the directory in File Explorer

    The screenshot below shows what you should see – the “workers” folder really does not exist.
    This image has an empty alt attribute; its file name is image-8.png

  3. Create a new folder called “workers”

    It doesn’t matter if it’s empty. No need to copy anything over from previous AzureFunctionsTools (although you can if you really want to). You just need a new empty folder named “workers”.

    Like in the screenshot below:
    This image has an empty alt attribute; its file name is image-9.png

  4. Run your functions again

    It should now work – like magic :)

And there we go – you should be good (for now).

Did it work for you? Let me know in the comments -section below!

References

mm
5 1 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments