<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.2.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NetService/ErrorCode-swift.enum",
  "metadataVersion" : "0.1.0",
  "role" : "Enumeration",
  "symbol" : {
    "kind" : "Enumeration",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:@E@NSNetServicesError"
  },
  "title" : "NetService.ErrorCode"
}
-->

# NetService.ErrorCode

These constants identify errors that can occur when accessing net services.

```
enum ErrorCode
```

## Topics

### Constants

[`NetService.ErrorCode.unknownError`](/documentation/Foundation/NetService/ErrorCode-swift.enum/unknownError)

An unknown error occurred.

[`NetService.ErrorCode.collisionError`](/documentation/Foundation/NetService/ErrorCode-swift.enum/collisionError)

The service could not be published because the name is already in use. The name could be in use locally or on another system.

[`NetService.ErrorCode.notFoundError`](/documentation/Foundation/NetService/ErrorCode-swift.enum/notFoundError)

The service could not be found on the network.

[`NetService.ErrorCode.activityInProgress`](/documentation/Foundation/NetService/ErrorCode-swift.enum/activityInProgress)

The net service cannot process the request at this time. No additional information about the network state is known.

[`NetService.ErrorCode.badArgumentError`](/documentation/Foundation/NetService/ErrorCode-swift.enum/badArgumentError)

An invalid argument was used when creating the `NSNetService` object.

[`NetService.ErrorCode.cancelledError`](/documentation/Foundation/NetService/ErrorCode-swift.enum/cancelledError)

The client canceled the action.

[`NetService.ErrorCode.invalidError`](/documentation/Foundation/NetService/ErrorCode-swift.enum/invalidError)

The net service was improperly configured.

[`NetService.ErrorCode.timeoutError`](/documentation/Foundation/NetService/ErrorCode-swift.enum/timeoutError)

The net service has timed out.



---

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)