<!--
{
  "availability" : [
    "iOS: 16.1.0 -",
    "iPadOS: 16.1.0 -",
    "macCatalyst: 17.0.0 -",
    "macOS: 14.0.0 -",
    "tvOS: 16.1.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 9.1.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "MusicKit",
  "identifier" : "/documentation/MusicKit/MusicLibrary/Error",
  "metadataVersion" : "0.1.0",
  "role" : "Enumeration",
  "symbol" : {
    "kind" : "Enumeration",
    "modules" : [
      "MusicKit"
    ],
    "preciseIdentifier" : "s:8MusicKit0A7LibraryC5ErrorO"
  },
  "title" : "MusicLibrary.Error"
}
-->

# MusicLibrary.Error

An error that the music library can throw upon accessing, manipulating, or requesting data from the user’s music library.

```
enum Error
```

## Topics

### Enumeration Cases

[`case addToPlaylistFailed`](/documentation/MusicKit/MusicLibrary/Error/addToPlaylistFailed)

An error that indicates a failure in the process of
adding an item to a playlist.

[`case createPlaylistFailed`](/documentation/MusicKit/MusicLibrary/Error/createPlaylistFailed)

An error that indicates a failure in the process of
creating a playlist.

[`case editPlaylistFailed`](/documentation/MusicKit/MusicLibrary/Error/editPlaylistFailed)

An error that indicates a failure in the process of
editing a playlist.

[`case itemAlreadyAdded`](/documentation/MusicKit/MusicLibrary/Error/itemAlreadyAdded)

An error indicating that the item attempting to be added
to the user’s music library is already in the library.

[`case permissionDenied`](/documentation/MusicKit/MusicLibrary/Error/permissionDenied)

An error that occurs when the user doesn’t consent for the
current app to access their Apple Music library.

[`case playlistNotInLibrary`](/documentation/MusicKit/MusicLibrary/Error/playlistNotInLibrary)

An error indicating that the playlist attempting to be
added to is not in the user’s library.

[`case unableToAddItem`](/documentation/MusicKit/MusicLibrary/Error/unableToAddItem)

An error indicating that the item attempting to be added
to the user’s music library cannot be added.

[`case unknown`](/documentation/MusicKit/MusicLibrary/Error/unknown)

An error indicating the ocurrence of an unknown or unexpected error.

## Relationships

### Conforms To

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

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

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

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

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

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

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

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

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

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

---

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)