| Previous | Next |
| ERROR_DEVICE_SUPPORT_IN_PROGRESS | ERROR_ATOMIC_LOCKS_NOT_SUPPORTED |
ERROR_CANCEL_VIOLATION
The requested lock cancellation has no matching operation
ERROR_CANCEL_VIOLATION is a Win32 result associated with file-region locking and cancellation., diagnosis should begin with the exact API, target object, and operation that produced it rather than with the message text alone.
What the result means
A cancel request did not match an outstanding lock operation for the supplied region. The practical meaning depends on the caller and on whether the affected object is local, remote, removable, policy-managed, or handled asynchronously. Diagnostics for it should retain its symbolic name, numeric value, and the operation name together.
What to check
- Verify that the offset and length exactly match the outstanding lock request.
- Track whether the lock completed, timed out, or was already canceled on another thread.
- Review asynchronous cleanup paths for duplicate cancellation.
- Log the file identity, overlapped structure, byte range, and owner thread.
Recommended handling
Correct the lock lifecycle instead of ignoring this result. Cancellation should be issued once, against the same operation object and range that was originally submitted.
Developer notes
Code handling this result should capture the failing API, resolved path or device identity, requested access, process identity, and the first observed error. After a call that reports it, read GetLastError() immediately because later cleanup or logging can overwrite the value. Retry it only when the specific condition is documented as transient, using a bounded delay and cancellation support.
References
- Microsoft: System error codes relevant to ERROR_CANCEL_VIOLATION
- Microsoft: File management context for ERROR_CANCEL_VIOLATION
Looking for a different code? Search another status or error code.