| Previous | Next |
| MQ_ERROR_PROPERTIES_CONFLICT | MQ_ERROR_CANT_RESOLVE_SITES |
MQ_ERROR_MESSAGE_NOT_FOUND
Interpretation
When MQ_ERROR_MESSAGE_NOT_FOUND appears, start with the queue operation and its property arrays rather than with a broad repair of the Message Queuing service. In this case the decisive subject is lookup/cursor target no longer exists. Another consumer, purge, expiration, transaction outcome, or administrative action may have removed it.
For MQ_ERROR_MESSAGE_NOT_FOUND, reopening by the same path after deletion can identify a new queue object. When diagnosing MQ_ERROR_MESSAGE_NOT_FOUND, the application must decide whether resuming against that new object is safe or whether the work item belongs to the old generation.
When diagnosing MQ_ERROR_MESSAGE_NOT_FOUND, for asynchronous or transactional reads, cleanup must be coordinated with callback and transaction owners. In the MQ_ERROR_MESSAGE_NOT_FOUND path, closing a handle from another thread can be the cause rather than the cure.
Relevant API contract
| Subsystem | queue and handle lifetime across deletion, service restart, asynchronous reads, and competing consumers |
|---|---|
| Decisive boundary | an object that was valid when opened may no longer identify the same queue-manager generation or message |
| Code-specific focus | lookup/cursor target no longer exists |
| Primary recovery rule | Treat lookup IDs as transient and reconcile consumer concurrency. |
When diagnosing MQ_ERROR_MESSAGE_NOT_FOUND, the same pathname does not prove object identity across restart or recreation. In the MQ_ERROR_MESSAGE_NOT_FOUND path, handles and message lookup IDs belong to a particular lifetime. For MQ_ERROR_MESSAGE_NOT_FOUND, the code-specific boundary is lookup/cursor target no longer exists.
Decisive observations
- Queue deletion/recreation events and current format name; associate it explicitly with
MQ_ERROR_MESSAGE_NOT_FOUND. - When diagnosing
MQ_ERROR_MESSAGE_NOT_FOUND, lookup id, cursor action, transaction, and competing consumer activity; capture the value before cleanup or retry changes it. - In the
MQ_ERROR_MESSAGE_NOT_FOUNDpath, handle creation time and msmq service restart time; compare it with a known-good call using the same account and queue type. - For this
MQ_ERROR_MESSAGE_NOT_FOUNDresult, record the queue path or format name, local/remote placement, transactional flag, caller SID, process build, and UTC correlation ID when they apply.
For MQ_ERROR_MESSAGE_NOT_FOUND, log certificate thumbprints, provider names, SIDs, GUIDs, lengths, and hashes where useful, but do not log private keys, symmetric keys, credentials, or confidential message bodies.
Troubleshooting workflow
- Record the unsigned HRESULT,
MQ_ERROR_MESSAGE_NOT_FOUND, and the native API or COM method before a framework replaces it with a generic exception. - When diagnosing
MQ_ERROR_MESSAGE_NOT_FOUND, capture queue deletion/recreation events and current format name. - Reproduce with the smallest queue/message/property set that still returns
MQ_ERROR_MESSAGE_NOT_FOUND; change one precondition at a time. - For this
MQ_ERROR_MESSAGE_NOT_FOUNDresult, verify the postcondition after the failed call: queue existence, message presence, directory object state, transaction outcome, or generated output may differ by result. - For
MQ_ERROR_MESSAGE_NOT_FOUND, capture handle creation time and MSMQ service restart time. - When diagnosing
MQ_ERROR_MESSAGE_NOT_FOUND, apply the code-specific recovery rule: Treat lookup IDs as transient and reconcile consumer concurrency.
Recovery rules
Treat lookup IDs as transient and reconcile consumer concurrency.
When diagnosing MQ_ERROR_MESSAGE_NOT_FOUND, do not hide this HRESULT behind an unlimited framework retry. In the MQ_ERROR_MESSAGE_NOT_FOUND path, require a verified precondition change and preserve the original correlation identifier across the next attempt.
Differences that matter
In the MQ_ERROR_MESSAGE_NOT_FOUND path, reusing the same pathname after restart or recreation does not revive the old handle, lookup identifier, message lock, or transaction context. The specific focus for MQ_ERROR_MESSAGE_NOT_FOUND remains lookup/cursor target no longer exists.
- In the
MQ_ERROR_MESSAGE_NOT_FOUNDpath, changing queue names, deleting directory objects, or recreating certificates without reconciliation can create a second object while callers still reference the first. - For this
MQ_ERROR_MESSAGE_NOT_FOUNDresult, A successful test under an interactive administrator account does not prove that the production service account has the same profile, token, directory access, or key permissions.
Practical scenario
An asynchronous receive loop encounters MQ_ERROR_MESSAGE_NOT_FOUND. For MQ_ERROR_MESSAGE_NOT_FOUND, it closes invalid objects, resolves the current queue generation, and reconciles whether another consumer completed the work. When diagnosing MQ_ERROR_MESSAGE_NOT_FOUND, the acceptance test then changes only the decisive precondition and confirms both the HRESULT and the actual queue/message state.
Automated coverage should preserve the original arrays/identities, confirm that cleanup is safe after MQ_ERROR_MESSAGE_NOT_FOUND, and test that a retry does not duplicate messages or directory objects.
Sources
- Microsoft: MQReceiveMessage — source used for the
MQ_ERROR_MESSAGE_NOT_FOUNDanalysis. - Microsoft: MQReceiveMessageByLookupId — source used for the
MQ_ERROR_MESSAGE_NOT_FOUNDanalysis. - Microsoft Open Specifications: Queue Manager Remote Read Protocol — source used for the
MQ_ERROR_MESSAGE_NOT_FOUNDanalysis. - Microsoft: Message Queuing error and information codes — source used for the
MQ_ERROR_MESSAGE_NOT_FOUNDanalysis.
Looking for a different code? Search another status or error code.