| Previous | Next |
| QUERY_E_INVALIDRESTRICTION | QUERY_E_INVALIDCATEGORIZE |
QUERY_E_INVALIDSORT
The requested sort specification is invalid
QUERY_E_INVALIDSORT is HRESULT 0x80041603. Windows documents it as “An invalid sort order was requested.”
Interpretation
This result belongs to legacy Windows query execution and is returned while validating sort keys and direction after the base query has been assembled. The exact condition is: an ordering-contract failure involving property identity, sort eligibility, syntax or sequence.
Concrete sources
A failed command or empty rowset is only the visible symptom; it does not identify which restriction, projection, sort, scope, timeout or catalog state violated the query contract.
Observability checklist
- Record the source and normalization path of ordered sort list, not only its display form.
- Record direction tokens before releasing the relevant objects.
- Associate sort eligibility metadata with the exact UTC timestamp and correlation identifier.
- Compare failing and known-good values for query result without ORDER BY under the same provider or handler version.
- Record the source and normalization path of provider command text and dialect, not only its display form.
Redact private literals if necessary, but keep clause boundaries, canonical properties, parameter types, dialect and parser or provider offsets.
Investigation order
- Capture ordered sort list and canonical property names at the call boundary that returns this result.
- Confirm the operation reached validating sort keys and direction after the base query has been assembled with the intended direction tokens.
- prove the query succeeds without sorting and then restore canonical sort keys one at a time.
Begin with a known-good minimal command against the same catalog and restore projection, restriction, sorting, grouping and scope one component at a time.
Corrective action
Emit the provider-specific direction syntax and use only sortable properties. Backoff helps only with measured transient load or timeout; it cannot repair invalid clauses, projection metadata, scopes or command state.
What must not be inferred
It does not by itself prove catalog corruption, service outage, access denial or absence of matches; the query stage and provider records must identify the failing clause or state.
Neighboring status codes
QPARSE_E_NO_SUCH_SORT_PROPERTY rejects a key and QPARSE_E_INVALID_SORT_ORDER rejects its direction token.
Developer and administrator guidance
Retain final command text, dialect, catalog generation, parameter values, timeout, cancellation state and chained OLE DB error records. Before rebuilding the catalog or restarting the provider, reproduce the minimal command and preserve its chained errors.
Reproduction example
A generic builder emits a direction keyword from another dialect. The unsorted query works; a dialect-specific sort serializer restores ordering.
Official Microsoft references
Looking for a different code? Search another status or error code.
