SQL Agent Error 7000: The System Cannot Find the File Specified

SQL Agent error 7000 means Windows cannot find the file the SQL Server Agent service tries to run. This post comes from a DBA at one of my consulting engagements. After the operating system restarted, the SQL Server Agent service did not start. It was set to start automatically.

Gouache painting of a weathered wooden fingerpost at a crossroads, its vermilion arm pointing at an empty field while a small stone cottage stands in the other direction

The Error

I looked for error messages and found this in the System event log:

Log Name:      System
Source:        Service Control Manager
Event ID:      7000
Task Category: None
Level:         Error
Keywords:      Classic
User:          N/A
Description:
The SQL Server Agent (MSSQLSERVER) service failed to start due to the following error:
The system cannot find the file specified.

The message means that Windows tries to start the process (sqlagent.exe) and fails.

What the Client Saw

My client told me they had an issue with SQL Server Agent. After the restart, the service did not start, although they had set it to start automatically. When we tried to start it by hand, we got the same error that is in the event log:

Services dialog: Windows could not start the SQL Server Agent (MSSQLSERVER) service on Local Computer. Error 2: The system cannot find the file specified.

How to Check

I opened the properties of the service and found that the Path to executable was invalid:

SQL Server Agent (MSSQLSERVER) Properties window, General tab. The service name SQLSERVERAGENT is highlighted, and the Path to executable box, outlined in red, starts with F:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER. Startup type is Manual and the service is stopped.

The picture also shows the startup type as Manual, although they believed it was automatic. Check that setting too.

The value was:

"F:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\MSSQL\Binn\SQLAGENT.EXE" -i MSSQLSERVER

Why It Happens

For this client, all the binaries are on the C: drive. Ideally the path should have been:

"C:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\MSSQL\Binn\SQLAGENT.EXE" -i MSSQLSERVER

The path pointed to a drive where the file does not exist, so the service could not find it. My client was not sure how it got changed.

The Fix

The path lives in the ImagePath value under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SQLSERVERAGENT. First identify the name of the service, shown as Service name in the properties. For a named instance of SQL Server, it is SQLAgent$InstanceName. Then change the ImagePath value to the correct path.

Registry Editor open at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SQLSERVERAGENT, with the ImagePath value highlighted. Its data starts with F:\Program Files\Microsoft SQL Server\MSSQL14.

Confirm It Worked

After I changed ImagePath to the C: drive path, we were able to start the SQL Server Agent service, and the issue was resolved.

How to Prevent It

When a service fails like this after a restart, compare its path to the executable with where the files are.

Have you seen this error in your environment? Tell me in the comments what you did to solve it.

Quick reference card: SQL Agent Error 7000

Error 7000 is not a missing program, it is a service pointing at the wrong address.

Published by Pinal Dave on SQLAuthority. More of my work at pinaldave.com.


Discover more from SQL Authority with Pinal Dave

Subscribe to get the latest posts sent to your email.

Registry, SQL Error Messages, SQL Server, SQL Server Agent, SQL Server Services
Previous Post
Error 15141: Upgrade Fails Because a Login Owns an Availability Group
Next Post
Agent Service Missing in Configuration Manager: The Fix

Related Posts

8 Comments. Leave new

  • James Stevens
    August 8, 2020 1:51 am

    Thanks, this was helpful. Yes, it is happening for me. My situation is I have MS SQL installed on a separate vhdx (HyperV) virtual hard disk (not the C: drive which I have reserved for the 2019 OS). So, the path is right; however, on reboot I am still working to get the vhdx to mount automatically. The vhdx file is on the host rather than the VM. I think all will work if I can get the drive to attach (it works fine when I manually attach the drive).

    Reply
  • I have a similar problem where after rebooting the SQL Server Service does not restart automatically even though it is set to. The error message is the same as in this article – event 7000 – “The system cannot find the file specified”. I can manually start the service though without changing anything. Does anyone have an idea why this would happen?

    Reply
  • while my problem was wildly different (wrong drive letter after restore), your article triggered an “aha” moment to check on that. thank you !

    Reply
  • Chuck Hamilton
    April 5, 2021 5:27 pm

    What we eventually figured out was that SQL was trying to start before the iSCSI drives had become available. The solution was to make the SQL Server service dependent on the Microsoft iSCSI initiator service.

    Reply
  • Thank you! This article gave a direction on where and what to check ,which ultimately cleared the problem.

    Reply
  • Chuck Hamilton
    June 9, 2021 7:37 pm

    Update: In my case the problem was a service needed to mount the drive was starting after SQL Server started. I had to add a dependency on the SQL service to ensure it started second.

    Reply
  • Ashish Pandey
    June 14, 2021 5:57 pm

    check your sqlservr.exe file is not corrupted, if it is then try to start sql server from CMD C:Program FilesMicrosoft SQL ServerMSSQL12.MSSQLSERVERMSSQLBinnsqlservr.exe -s MSSQLEXPRESS, if this not able to launch SQL then replace sqlservr.exe and job DONE!!

    Reply
  • Jean-Luc de Jong
    November 24, 2021 4:57 pm

    From my side, this problem appears after an upgrade from SQL2012 to SQL2014. I followed your article and it solved my problem. Thanks a lot

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.