What does Windows error code 1431 (ERROR_HOOK_NOT_INSTALLED) mean?

 
Previous Next
ERROR_JOURNAL_HOOK_SET ERROR_INVALID_LB_MESSAGE

ERROR_HOOK_NOT_INSTALLED

No matching installed hook is present

Hook state has an install/remove lifecycle. SetWindowsHookEx returns an HHOOK; UnhookWindowsHookEx removes that installed hook. Cleanup code must preserve whether installation actually succeeded.

This condition commonly appears after double cleanup, partial initialization, or one thread removing a shared hook while another thread still believes it owns the registration. It can also expose code that records configuration intent instead of the actual returned hook handle.

What to check

  • Set the installed-state flag only after SetWindowsHookEx returns a valid handle.
  • Serialize shared hook teardown and make it idempotent.
  • Clear ownership after a successful unhook and prevent later duplicate cleanup.
  • Capture the original installation failure rather than continuing with a fabricated state.

ERROR_INVALID_HOOK_HANDLE focuses on the handle value itself; this status describes the absence of the expected installed hook state.

References


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