| Previous | Next |
| QUERY_E_INVALIDRESTRICTION | QUERY_E_INVALIDCATEGORIZE |
QUERY_E_INVALIDSORT
The requested sort specification is invalid
QUERY_E_INVALIDSORT is the failure HRESULT 0x80041603 (-2147215869 signed; 2147751427 unsigned). Its severity bit is 1, facility is 4 (FACILITY_ITF), and code is 0x1603. AllStat describes 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. This stage matters because converting the result to a generic COM failure removes the information needed to choose the owner and retry policy.
This value belongs to the legacy Indexing Service query-execution contract. It can surface through the Indexing Service OLE DB provider or related query interfaces, but it should not be presented as a generic result from every modern Windows Search API. Current Windows Search SQL documentation can clarify related clause concepts, but it does not establish that every current search API returns this legacy query-execution constant.
Concrete sources
- changes in ordered sort list between validation and execution can reproduce the result even when the user-visible input looks unchanged.
- Retrying this result with the same canonical property names leaves the decisive contract violation intact.
- This result can appear when direction tokens disagrees with the state expected while validating sort keys and direction after the base query has been assembled.
- a stale or transformed sort eligibility metadata can make the component observe that an ordering-contract failure involving property identity, sort eligibility, syntax or sequence.
- an incomplete query result without ORDER BY hides the distinction needed to separate this HRESULT from a later catalog or service failure.
The strongest hypothesis for this HRESULT must account for the operation—validating sort keys and direction after the base query has been assembled—and the documented condition. 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.
- use canonical property names to test whether the failure belongs to parsing, execution, indexing or capability negotiation.
- preserve direction tokens before objects or work items are released.
- 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.
Evidence for this HRESULT should reflect what the component actually received. 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.
- perform the decisive check: prove the query succeeds without sorting and then restore canonical sort keys one at a time.
- reduce the case until changing sort eligibility metadata alone changes the HRESULT or proves it irrelevant.
- apply the recovery only after verifying query result without ORDER BY; preserve the original result for comparison.
A useful control for this HRESULT changes one dimension 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. Retry it only after the responsible input or state changes and the previous operation has completed or been cancelled. 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. Without code-specific evidence for this HRESULT, the value also cannot identify which wrapper, configuration, handler or service transition introduced the condition.
Neighboring status codes
QPARSE_E_NO_SUCH_SORT_PROPERTY rejects a key and QPARSE_E_INVALID_SORT_ORDER rejects its direction token. Keep the symbolic HRESULT beside the stage name in telemetry because nearby constants may require different owners, user messages and retry rules despite the same visible symptom.
Developer and administrator guidance
Retain final command text, dialect, catalog generation, parameter values, timeout, cancellation state and chained OLE DB error records. Do not log credentials or unrestricted document content. Before rebuilding the catalog or restarting the provider for this HRESULT, 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. A regression test for this HRESULT should assert the decisive evidence, change only the responsible condition, and include one neighboring HRESULT so future code cannot collapse distinct failures into a generic message.
Official Microsoft references
- Microsoft: Indexing Service query-execution values
- Microsoft: Windows Search ORDER BY clause
- Microsoft: Windows Search SQL syntax
- Microsoft: OLE DB provider for Indexing Service
Looking for a different code? Search another status or error code.