CI failing with Blocking waiting for file lock on build directory

We are writing an email-based instant messenger in Rust (the UIs are in other languages):

Now, our CIs are constantly failing with

Blocking waiting for file lock on build directory

For example:

My first try fixing this was to kill the process if it blocks, do cargo clean and retry (in Python):


  1. Is there any solution that does not take as long as cargo clean? (because everything has to be rebuilt afterwards)
  2. Not every CI script is in Rust, some are shell scripts. I could extract this to a Python script that can be invoked both from Python and Shell but is there any better solution?

Thanks for your help!

I started to see that message when using Visual Studio code and the rust-analyzer extension. There is some config one can set to stop it locking the build directory. Sorry I forget what exactly.

There can be a tug of war if one has two compilations going on at the same time or the Rust Language Server running.

Others have seen it with apparently different causes. See for example:

Thanks a lot for your quick answer!

However, I have seen both of the links you sent (and many more) but they didn't help me (well they did, the second one got me the idea with cargo clean but I still have the questions posted above)

This might be a great help if you remembered where to find this option because I was looking for a very long time for such an option.

This might help:,You%20can%20modify%20the%20search.

And see "Exclude Folders" here:

Both links you sent are about IDEs. I am talking about the CI (a server where only the tests are run in a container or VM, nothing else and definitely not another cargo command)

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.