Error 21: Windows Search Service Could not Start on Local Computer

When you attempt to start the Windows Search (WSearch) service via the Services MMC, the following error may occur:

Windows could not start the Windows Search service on Local Computer

Error 21: The device is not ready.

windows search service could not start - error 21

The result is the same when you run the net start wsearch command from a Command Prompt window. It returns the following error:

The Windows Search service could not be started.

A system error has occurred.

System error 21 has occurred.

The device is not ready.

windows search service could not start - error 21

You may have tried running the Windows Search troubleshooter already.

Cause

This error occurs if the “DefaultApplicationsPath” or “TempPath” registry values point to a non-existent drive letter. A user on your computer may have redirected the Windows Search data folder to a removable (USB) drive and that drive letter (e.g., E:\ ) may now be unavailable.

In that case, the event log entries are created:

The Windows Search Service has failed to create the new search index. Internal error <1, 0x80070003, Failed to create application directory: E:\Search\Data\Applications>" will be created.
The Windows Search service terminated with the following error:
The device is not ready.

Windows Search Error 21 can also happen if the Windows Search index database (Windows.edb) is locked. The error code 21 could also mean “ERROR_LOCK_VIOLATION” – The process cannot access the file because another process has locked a portion of the file.



Resolution

To resolve the Windows Search service error 21, follow the steps below:

Step 1: Fix the Windows Search folder paths in the registry

  1. Download AdvancedRun from Nirsoft.net and run it.
  2. Using AdvancedRun, start the Registry Editor (regedit.exe) as TrustedInstaller.
    advancedrun start regedit.exe

  3. In the Registry Editor, go to the following branch:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Search\Gathering Manager
  4. Double-click DefaultApplicationsPath and set its data as follows:
    %ProgramData%\Microsoft\Search\Data\Applications\
  5. Double-click TempPath and set its data as follows:
    %ProgramData%\Microsoft\Search\Data\Temp\usgthrsvc
  6. Go to the following branch:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Search
  7. Double-click DataDirectory and set its data as follows:
    %ProgramData%\Microsoft\Search\Data\
  8. Double-click DefaultDataDirectory and set its data as follows:
    %ProgramData%\Microsoft\Search\Data\
    Important: Make sure the registry value type of the above values is REG_EXPAND_SZ. If the value is REG_SZ, delete it and create a new value of type REG_EXPAND_SZ.
  9. Exit the Registry Editor.

Attempt to start the Windows Search service now. If the same error occurs, proceed to Step 2 below.


Step 2: Delete the Windows Search index database

Open Task Manager and kill searchindexer.exe if it exists. We need to delete or rename the file “Windows.edb” in the following folder:

C:\ProgramData\Microsoft\Search\Data\Applications\Windows\

Open admin Command Prompt and run the following commands:

sc config wsearch start= disabled

net stop wsearch

rd /s /q C:\ProgramData\Microsoft\Search\Data\Temp

cd /d C:\ProgramData\Microsoft\Search\Data\Applications\Windows\

ren Projects Projects.old

del windows.edb /a

del windows.db /a

reg add "HKLM\SOFTWARE\Microsoft\Windows Search" /v SetupCompletedSuccessfully /d 1 /t reg_dword /f

sc config wsearch start= auto

net start wsearch

This resets the Windows Search index.

See if you’re able to start the Windows Search service now.


One small request: If you liked this post, please share this?

One "tiny" share from you would seriously help a lot with the growth of this blog. Some great suggestions:
  • Pin it!
  • Share it to your favorite blog + Facebook, Reddit
  • Tweet it!
So thank you so much for your support. It won't take more than 10 seconds of your time.

Ramesh Srinivasan is passionate about Microsoft technologies and he has been a ten-time recipient of the Microsoft MVP award in Windows Desktop Experience (Windows Shell), from 2003 to 2012. Ramesh founded Winhelponline.com in 2005.

7 thoughts on “Error 21: Windows Search Service Could not Start on Local Computer”

  1. Hi – no success:
    1. Fix the Windows Search folder paths in the registry – there was nothing to fix, everything was as you specify.
    2. There was no Windows.edb file in C:\ProgramData\Microsoft\Search\Data\Applications\Windows\
    When I Open admin Command Prompt and run the specified commands it gives me:

    The Windows Search service is starting.
    The Windows Search service could not be started.

    A system error has occurred.

    System error 21 has occurred.

    The device is not ready.

    Reply
  2. Hi,

    that help really solved all my Windows Search problem – thank you very much!
    I did reinstall my Windows 11 Pro already using ISO files but nothing worked so far…

    You saved my day…

    Reply
  3. Hi Ramesh,

    thank you very much!This was the second time your tips about Windows Search helped me. Your are “Mr. Windows Search”.

    A request:

    The Article

    “Unable to Start Windows Search Service “Error 3: The System Cannot Find the Path
    Specified”

    at Microsoft, it may have been shortened for data protection reasons to the point where it is no longer comprehensible. Perhaps you could republish your solution here. That would certainly help many people.

    Best regards

    Reply
    • Hi @Volker,

      Thank you very much for the feedback!

      On that Microsoft link, the OP may have redacted the batch file output. Are you referring to that?

  4. Hi Ramesh,

    That’s exactly the problem: In your reply dated November 21, 2024, at 5:57 p.m., you wrote…
    “…fix the two values.”

    However, due to Microsoft’s deletion, readers can no longer figure out which values these are. Perhaps you could bring this topic up on your site. I’m sure you would be doing many desperate Windows users a big favor.

    Best regards,

    Volker

    Reply
    • @Volker: The two values are the ones the OP was referring to.

      By the way, the values that need to be fixed are included in this article (Step 1) already.

Leave a Comment