<!--
{
  "documentType" : "article",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/file-system-error-codes",
  "metadataVersion" : "0.1.0",
  "role" : "collectionGroup",
  "title" : "File System Error Codes"
}
-->

# File System Error Codes

Recognize common error codes generated by file system operations.

## Topics

### Error Codes

[`NSFileNoSuchFileError`](/documentation/Foundation/NSFileNoSuchFileError-swift.var)

A filesystem operation was attempted on a non-existent file.

[`NSFileLockingError`](/documentation/Foundation/NSFileLockingError-swift.var)

The file could not be locked.

[`NSFileReadUnknownError`](/documentation/Foundation/NSFileReadUnknownError-swift.var)

Could not read, for unknown reasons.

[`NSFileReadNoPermissionError`](/documentation/Foundation/NSFileReadNoPermissionError-swift.var)

Could not read because of a permission problem.

[`NSFileReadInvalidFileNameError`](/documentation/Foundation/NSFileReadInvalidFileNameError-swift.var)

Could not read because of an invalid file name.

[`NSFileReadCorruptFileError`](/documentation/Foundation/NSFileReadCorruptFileError-swift.var)

Could not read because of a corrupted file, bad format, or similar reason.

[`NSFileReadNoSuchFileError`](/documentation/Foundation/NSFileReadNoSuchFileError-swift.var)

Could not read because no such file was found.

[`NSFileReadInapplicableStringEncodingError`](/documentation/Foundation/NSFileReadInapplicableStringEncodingError-swift.var)

Could not read because the string encoding wasn’t applicable.

[`NSFileReadUnsupportedSchemeError`](/documentation/Foundation/NSFileReadUnsupportedSchemeError-swift.var)

Could not read because the specified URL scheme is unsupported.

[`NSFileReadTooLargeError`](/documentation/Foundation/NSFileReadTooLargeError-swift.var)

Could not read because the specified file was too large.

[`NSFileReadUnknownStringEncodingError`](/documentation/Foundation/NSFileReadUnknownStringEncodingError-swift.var)

Could not read because the string coding of the file couldn’t be determined.

[`NSFileWriteUnknownError`](/documentation/Foundation/NSFileWriteUnknownError-swift.var)

Could not write, for unknown reasons.

[`NSFileWriteNoPermissionError`](/documentation/Foundation/NSFileWriteNoPermissionError-swift.var)

Could not write because of a permission problem.

[`NSFileWriteInvalidFileNameError`](/documentation/Foundation/NSFileWriteInvalidFileNameError-swift.var)

Could not write because of an invalid file name.

[`NSFileWriteFileExistsError`](/documentation/Foundation/NSFileWriteFileExistsError-swift.var)

Could not perform an operation because the destination file already exists.

[`NSFileWriteInapplicableStringEncodingError`](/documentation/Foundation/NSFileWriteInapplicableStringEncodingError-swift.var)

Could not write because the string encoding was not applicable.

[`NSFileWriteUnsupportedSchemeError`](/documentation/Foundation/NSFileWriteUnsupportedSchemeError-swift.var)

Could not write because the specified URL scheme is unsupported.

[`NSFileWriteOutOfSpaceError`](/documentation/Foundation/NSFileWriteOutOfSpaceError-swift.var)

Could not write because of a lack of disk space.

[`NSFileWriteVolumeReadOnlyError`](/documentation/Foundation/NSFileWriteVolumeReadOnlyError-swift.var)

Could not write because the volume is read-only.

[`NSFileManagerUnmountBusyError`](/documentation/Foundation/NSFileManagerUnmountBusyError-swift.var)

The volume couldn’t be unmounted because it’s in use.

[`NSFileManagerUnmountUnknownError`](/documentation/Foundation/NSFileManagerUnmountUnknownError-swift.var)

The volume couldn’t be unmounted, for unknown reasons.

[`NSFileErrorMinimum`](/documentation/Foundation/NSFileErrorMinimum-swift.var)

The start of the range of error codes reserved for file errors.

[`NSFileErrorMaximum`](/documentation/Foundation/NSFileErrorMaximum-swift.var)

The end of the range of error codes reserved for file errors.

[`NSFileNoSuchFileError`](/documentation/Foundation/NSFileNoSuchFileError-c.enum.case)

A filesystem operation was attempted on a non-existent file.

[`NSFileLockingError`](/documentation/Foundation/NSFileLockingError-c.enum.case)

The file could not be locked.

[`NSFileReadUnknownError`](/documentation/Foundation/NSFileReadUnknownError-c.enum.case)

Could not read, for unknown reasons.

[`NSFileReadNoPermissionError`](/documentation/Foundation/NSFileReadNoPermissionError-c.enum.case)

Could not read because of a permission problem.

[`NSFileReadInvalidFileNameError`](/documentation/Foundation/NSFileReadInvalidFileNameError-c.enum.case)

Could not read because of an invalid file name.

[`NSFileReadCorruptFileError`](/documentation/Foundation/NSFileReadCorruptFileError-c.enum.case)

Could not read because of a corrupted file, bad format, or similar reason.

[`NSFileReadNoSuchFileError`](/documentation/Foundation/NSFileReadNoSuchFileError-c.enum.case)

Could not read because no such file was found.

[`NSFileReadInapplicableStringEncodingError`](/documentation/Foundation/NSFileReadInapplicableStringEncodingError-c.enum.case)

Could not read because the string encoding wasn’t applicable.

[`NSFileReadUnsupportedSchemeError`](/documentation/Foundation/NSFileReadUnsupportedSchemeError-c.enum.case)

Could not read because the specified URL scheme is unsupported.

[`NSFileReadTooLargeError`](/documentation/Foundation/NSFileReadTooLargeError-c.enum.case)

Could not read because the specified file was too large.

[`NSFileReadUnknownStringEncodingError`](/documentation/Foundation/NSFileReadUnknownStringEncodingError-c.enum.case)

Could not read because the string coding of the file couldn’t be determined.

[`NSFileWriteUnknownError`](/documentation/Foundation/NSFileWriteUnknownError-c.enum.case)

Could not write, for unknown reasons.

[`NSFileWriteNoPermissionError`](/documentation/Foundation/NSFileWriteNoPermissionError-c.enum.case)

Could not write because of a permission problem.

[`NSFileWriteInvalidFileNameError`](/documentation/Foundation/NSFileWriteInvalidFileNameError-c.enum.case)

Could not write because of an invalid file name.

[`NSFileWriteFileExistsError`](/documentation/Foundation/NSFileWriteFileExistsError-c.enum.case)

Could not perform an operation because the destination file already exists.

[`NSFileWriteInapplicableStringEncodingError`](/documentation/Foundation/NSFileWriteInapplicableStringEncodingError-c.enum.case)

Could not write because the string encoding was not applicable.

[`NSFileWriteUnsupportedSchemeError`](/documentation/Foundation/NSFileWriteUnsupportedSchemeError-c.enum.case)

Could not write because the specified URL scheme is unsupported.

[`NSFileWriteOutOfSpaceError`](/documentation/Foundation/NSFileWriteOutOfSpaceError-c.enum.case)

Could not write because of a lack of disk space.

[`NSFileWriteVolumeReadOnlyError`](/documentation/Foundation/NSFileWriteVolumeReadOnlyError-c.enum.case)

Could not write because the volume is read-only.

[`NSFileManagerUnmountBusyError`](/documentation/Foundation/NSFileManagerUnmountBusyError-c.enum.case)

The volume couldn’t be unmounted because it’s in use.

[`NSFileManagerUnmountUnknownError`](/documentation/Foundation/NSFileManagerUnmountUnknownError-c.enum.case)

The volume couldn’t be unmounted, for unknown reasons.

[`NSFileErrorMinimum`](/documentation/Foundation/NSFileErrorMinimum-c.enum.case)

The start of the range of error codes reserved for file errors.

[`NSFileErrorMaximum`](/documentation/Foundation/NSFileErrorMaximum-c.enum.case)

The end of the range of error codes reserved for file errors.



---

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)