<!--
{
  "availability" : [
    "iOS: 10.0.0 -",
    "iPadOS: 10.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.12.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreSpotlight",
  "identifier" : "/documentation/CoreSpotlight/CSSearchQueryError/Code",
  "metadataVersion" : "0.1.0",
  "role" : "Enumeration",
  "symbol" : {
    "kind" : "Enumeration",
    "modules" : [
      "Core Spotlight"
    ],
    "preciseIdentifier" : "c:@E@CSSearchQueryErrorCode"
  },
  "title" : "CSSearchQueryError.Code"
}
-->

# CSSearchQueryError.Code

Error codes that describe reasons a query might fail.

```
enum Code
```

## Topics

### Getting the error codes

[`CSSearchQueryError.Code.cancelled`](/documentation/CoreSpotlight/CSSearchQueryError/Code/cancelled)

The query stopped because someone canceled it.

[`CSSearchQueryError.Code.indexUnreachable`](/documentation/CoreSpotlight/CSSearchQueryError/Code/indexUnreachable)

The index is unreachable.

[`CSSearchQueryError.Code.invalidQuery`](/documentation/CoreSpotlight/CSSearchQueryError/Code/invalidQuery)

The query is syntactically invalid or specifies items that your app
doesn’t have access to.

[`CSSearchQueryError.Code.unknown`](/documentation/CoreSpotlight/CSSearchQueryError/Code/unknown)

An unknown error occurred.

### Creating a query error

[`init(rawValue:)`](/documentation/CoreSpotlight/CSSearchQueryError/Code/init(rawValue:))



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)