| Previous | Next |
| QPLIST_E_BYREF_USED_WITHOUT_PTRTYPE | QPARSE_E_EXPECTING_INTEGER |
QPARSE_E_UNEXPECTED_NOT
A NOT operator is in an invalid position
QPARSE_E_UNEXPECTED_NOT is HRESULT 0x80041660. Windows documents it as “Unexpected NOT operator.”
Interpretation
This result belongs to legacy Windows query parsing and is returned while building a Boolean restriction. The exact condition is: NOT has no valid operand or follows another operator.
This value comes from the legacy Indexing Service query parser. The exact final string, parser mode, locale and target property schema matter more than the query text shown in a user interface, because escaping and serialization can alter the token stream before parsing. Current Search SQL documentation can help compare operators and property syntax, but the failing token must still be interpreted under this legacy parser dialect.
Concrete sources
A parse failure does not identify the expected token class, property type, locale conversion or escaping layer until the final parser input is preserved.
Observability checklist
- Compare failing and known-good values for previous token under the same provider or handler version.
- Record the source and normalization path of next token, not only its display form.
- Record query form before releasing the relevant objects.
- Associate builder fragment with the exact UTC timestamp and correlation identifier.
- Compare failing and known-good values for final parser input bytes under the same provider or handler version.
Preserve a bounded token window, offsets, quote and delimiter state, locale and canonical property identity without logging unrelated query text.
Investigation order
- Capture previous token and next token at the call boundary that returns this result.
- Confirm the operation reached building a Boolean restriction with the intended parenthesis depth.
- capture previous and next tokens plus grouping depth.
Begin with a minimal expression using the same property and parser mode, then add the failing literal, operator or delimiter without changing locale or escaping.
Corrective action
Place negation only where the target grammar permits it. Retrying identical parser bytes cannot succeed; regenerate the specific token or schema pairing that failed.
What must not be inferred
It does not prove that the user intent is invalid or that the catalog lacks data; it identifies how this parser interpreted the final serialized expression.
Neighboring status codes
QPARSE_E_UNEXPECTED_EOS is incomplete input; this value names the misplaced NOT.
Developer and administrator guidance
Retain final parser bytes, query form, token offset, expected token class, locale, escaping path and target property schema. Before changing catalog schema, prove the final token stream and property type at the parser boundary.
Reproduction example
An optional exclusion value is empty and leaves AND NOT. Token validation removes the dangling operator.
Official Microsoft references
Looking for a different code? Search another status or error code.
