What does Windows error code 641 (ERROR_SYSTEM_SHUTDOWN) mean?

 
Previous Next
ERROR_MULTIPLE_FAULT_VIOLATION ERROR_PORT_NOT_SET

ERROR_SYSTEM_SHUTDOWN

What ERROR_SYSTEM_SHUTDOWN means

During shutdown, services, sessions, devices, and system components are torn down in a controlled order. Calls that require components already stopping can return this code even though they would normally succeed.

Where it commonly appears

  • Service control handlers
  • Late writes and network calls during process shutdown
  • Installers or updaters racing with restart
  • Background workers that ignore the stop signal

Likely causes

  • The operation began after shutdown was initiated
  • A worker continued after its owning service entered stop-pending
  • An external restart policy interrupted a long transaction
  • Cleanup order calls a dependency after that dependency has stopped

Troubleshooting checklist

  1. Record when shutdown was announced relative to the failed call
  2. Inspect service-control and system shutdown events
  3. Check whether worker threads honor cancellation promptly
  4. Trace dependency teardown order
  5. Determine whether an installer or administrator initiated the restart

Guidance for developers

Treat the code as a terminal cancellation for most new work. Stop accepting requests, commit only bounded essential state, and avoid starting replacement processes. Design operations so they can resume safely after reboot.

Guidance for administrators

Allow shutdown to complete. If the status appears during routine service stops, investigate slow or misordered application cleanup rather than blocking system shutdown indefinitely.

Example

A service receives the stop control but leaves a queue consumer running. The consumer starts a new network transaction after networking components begin shutdown and receives this code. Canceling the queue before dependency teardown fixes the race.

Related conditions

This differs from ERROR_SHUTDOWN_IN_PROGRESS only by the specific API path and code family; both indicate that shutdown state, not ordinary resource failure, is controlling the result.

References


Looking for a different code? Search another status or error code.