Option 1: Run “cargo clean”
Option 2: sudo pkill rls cargo
Option 3: delete ~/.cargo/.package-cache
Option 4: rm -rf ~/.cargo/registry/index/*
Also if you are on Windows (not sure about other operation systems). This issue can happen if your IDE is automatically compiling the project and locking a cargo file. You would get this error when trying to compile from command line. It is possible that you will also have to close the IDE in this case before trying the above.