| Previous | Next |
| QUERY_E_INVALIDQUERY | QUERY_E_INVALIDSORT |
QUERY_E_INVALIDRESTRICTION
The restriction expression could not be parsed
QUERY_E_INVALIDRESTRICTION is the failure HRESULT 0x80041602 (-2147215870 signed; 2147751426 unsigned). Its severity bit is 1, facility is 4 (FACILITY_ITF), and code is 0x1602. AllStat describes it as “The query restriction could not be parsed.”
Operation and state
This result belongs to legacy Windows query execution and is returned while parsing the predicate that limits catalog rows, including property comparisons and full-text conditions. The exact condition is: a WHERE/restriction grammar or type-pairing defect, not an empty-result condition. 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.
Failure paths to examine
- an incomplete final restriction text hides the distinction needed to separate this HRESULT from a later catalog or service failure.
- changes in parser offset between validation and execution can reproduce the result even when the user-visible input looks unchanged.
- Retrying this result with the same property schema leaves the decisive contract violation intact.
- This result can appear when literal type and locale disagrees with the state expected while parsing the predicate that limits catalog rows, including property comparisons and full-text conditions.
- a stale or transformed clause-by-clause reproducer can make the component observe that a WHERE/restriction grammar or type-pairing defect, not an empty-result condition.
The strongest hypothesis for this HRESULT must account for the operation—parsing the predicate that limits catalog rows, including property comparisons and full-text conditions—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.
Data to collect first
- compare failing and known-good values for final restriction text under the same provider or handler version.
- record the source and normalization path of parser offset, not only its display form.
- use property schema to test whether the failure belongs to parsing, execution, indexing or capability negotiation.
- preserve literal type and locale before objects or work items are released.
- associate clause-by-clause reproducer with the exact UTC timestamp and correlation identifier.
- compare failing and known-good values for provider command text and dialect under the same provider or handler version.
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.
Step-by-step diagnosis
- Capture final restriction text and parser offset at the call boundary that returns this result.
- confirm the operation reached parsing the predicate that limits catalog rows, including property comparisons and full-text conditions with the intended property schema.
- perform the decisive check: reduce the predicate until the exact operator, property, literal or delimiter that breaks parsing is isolated.
- reduce the case until changing literal type and locale alone changes the HRESULT or proves it irrelevant.
- apply the recovery only after verifying clause-by-clause reproducer; 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.
Continuation policy
Correct escaping, property type, operator or grouping and then rebuild the restriction structurally. 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.
Limits of this HRESULT
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.
Distinguishing similar results
QPARSE_E_INVALID_QUERY and token-specific QPARSE values can expose a more precise parser defect. 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.
Operational case
An unescaped quote enters a title predicate. Removing WHERE proves the projection works; restoring branches identifies the exact malformed clause. 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 WHERE clause
- Microsoft: Windows Search SQL syntax
- Microsoft: OLE DB provider for Indexing Service
Looking for a different code? Search another status or error code.