<!--
{
  "availability" : [
    "iOS: 16.0.0 - 27.2.0",
    "iPadOS: 16.0.0 - 27.2.0",
    "macCatalyst: 16.0.0 - 27.0.0",
    "visionOS: 1.0.0 - 27.2.0"
  ],
  "documentType" : "symbol",
  "framework" : "MetricKit",
  "identifier" : "/documentation/MetricKit/MXError",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "MetricKit"
    ],
    "preciseIdentifier" : "s:SC11MXErrorCodeLeV"
  },
  "title" : "MXError"
}
-->

# MXError

Error domain for error handling of app metrics.

```
struct MXError
```

## Topics

### Getting the error properties

[`enum Code`](/documentation/MetricKit/MXError/Code)

Error codes for error values from app metrics.

[`let MXErrorDomain: String`](/documentation/MetricKit/MXErrorDomain)

Error domain for error values from app metrics.

### Getting the launch error properties

[`static var errorDomain: String`](/documentation/MetricKit/MXError/errorDomain)

[`static var launchTaskDuplicated: MXError.Code`](/documentation/MetricKit/MXError/launchTaskDuplicated)

A task with the same ID has already been started.

[`static var launchTaskInternalFailure: MXError.Code`](/documentation/MetricKit/MXError/launchTaskInternalFailure)

Internal failures happened inside the framework.

[`static var launchTaskInvalidID: MXError.Code`](/documentation/MetricKit/MXError/launchTaskInvalidID)

The task ID is a `null` value or exceeds the maximum 128 character length.

[`static var launchTaskMaxCount: MXError.Code`](/documentation/MetricKit/MXError/launchTaskMaxCount)

Exceeded the maximum number of tasks.

[`static var launchTaskPastDeadline: MXError.Code`](/documentation/MetricKit/MXError/launchTaskPastDeadline)

The start call was made too late.

[`static var launchTaskUnknown: MXError.Code`](/documentation/MetricKit/MXError/launchTaskUnknown)

The task hasn’t been started or has already been finished.

[`enum Code`](/documentation/MetricKit/MXError/Code)

Error codes for error values from app metrics.

[`let MXErrorDomain: String`](/documentation/MetricKit/MXErrorDomain)

Error domain for error values from app metrics.

## Relationships

### Conforms To

[`Hashable`](/documentation/Swift/Hashable)

[`CustomNSError`](/documentation/Foundation/CustomNSError)

[`Error`](/documentation/Swift/Error)

[`Equatable`](/documentation/Swift/Equatable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Sendable`](/documentation/Swift/Sendable)

---

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)