<!--
{
  "availability" : [
    "iOS: 11.0.0 -",
    "iPadOS: 11.0.0 -",
    "macOS: 11.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "FileProvider",
  "identifier" : "/documentation/FileProvider/NSFileProviderError/filenameCollision",
  "metadataVersion" : "0.1.0",
  "role" : "Type Property",
  "symbol" : {
    "kind" : "Type Property",
    "modules" : [
      "File Provider"
    ],
    "preciseIdentifier" : "s:SC23NSFileProviderErrorCodeLeV17filenameCollisionSoAAVvpZ"
  },
  "title" : "filenameCollision"
}
-->

# filenameCollision

An error indicating that an item with the same name already exists in the same directory.

```
static var filenameCollision: NSFileProviderError.Code { get }
```

## Discussion

Use the <doc://com.apple.documentation/documentation/Foundation/NSError/fileProviderErrorForCollision(with:)> method to create properly formatted [`filenameCollision`](/documentation/FileProvider/NSFileProviderError/filenameCollision) errors.

You have two options for resolving file name collisions:

- Your file provider extension can return this error. In this case the system renames the new item.
- You can rename the new item yourself. This gives you complete control over the process.

---

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)