Text of rust.docs.kernel.org › next › core › io › enum.ErrorKind.html as Styx crawled it on Nov 19, 2026. The page may have changed since. Only its words are kept, without pictures or layout, and only the first part of a long page.

Open the live page

ErrorKind in core::io - Rust

Skip to main content ErrorKind core :: io Enum Error Kind Source #[non_exhaustive] pub enum ErrorKind { Show 43 variants NotFound, PermissionDenied, ConnectionRefused, ConnectionReset, HostUnreachable, NetworkUnreachable, ConnectionAborted, NotConnected, AddrInUse, AddrNotAvailable, NetworkDown, BrokenPipe, AlreadyExists, WouldBlock, NotADirectory, IsADirectory, DirectoryNotEmpty, ReadOnlyFilesystem, FilesystemLoop, StaleNetworkFileHandle, InvalidInput, InvalidData, TimedOut, WriteZero, StorageFull, NotSeekable, QuotaExceeded, FileTooLarge, ResourceBusy, ExecutableFileBusy, Deadlock, CrossesDevices, TooManyLinks, InvalidFilename, ArgumentListTooLong, Interrupted, Unsupported, UnexpectedEof, OutOfMemory, InProgress, TooManyOpenFiles, InputOutputError, Other, } 🔬 This is a nightly-only experimental API. ( core_io #154046 ) Expand description A list specifying general categories of I/O error.

This list is intended to grow over time and it is not recommended to exhaustively match against it. It is used with the io::Error type. § Handling errors and matching on ErrorKind In application code, use match for the ErrorKind values you are expecting; use _ to match “all other errors”. In comprehensive and thorough tests that want to verify that a test doesn’t return any known incorrect error kind, you may want to cut-and-paste the current full list of errors from here into your test code, and then match _ as the correct case.

This seems counterintuitive, but it will make your tests more robust. In particular, if you want to verify that your code does produce an unrecognized error kind, the robust solution is to check for all the recognized error kinds and fail in those cases. Variants (Non-exhaustive) § This enum is marked as non-exhaustive Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants. § NotFound 🔬 This is a nightly-only experimental API. ( core_io #154046 ) An entity was not found, often a file. § PermissionDenied 🔬 This is a nightly-only experimental API. ( core_io #154046 ) The operation lacked the necessary privileges to complete. § ConnectionRefused 🔬 This is a nightly-only experimental API. ( core_io #154046 ) The connection was refused by the remote server. § ConnectionReset 🔬 This is a nightly-only experimental API. ( core_io #154046 ) The connection was reset by the remote server. § HostUnreachable 🔬 This is a nightly-only experimental API. ( core_io #154046 ) The remote host is not reachable. § NetworkUnreachable 🔬 This is a nightly-only experimental API. ( core_io #154046 ) The network containing the remote host is not reachable. § ConnectionAborted 🔬 This is a nightly-only experimental API. ( core_io #154046 ) The connection was aborted (terminated) by the remote server. § NotConnected 🔬 This is a nightly-only experimental API. ( core_io #154046 ) The network operation failed because it was not connected yet. § AddrInUse 🔬 This is a nightly-only experimental API. ( core_io #154046 ) A socket address could not be bound because the address is already in use elsewhere. § AddrNotAvailable 🔬 This is a nightly-only experimental API. ( core_io #154046 ) A nonexistent interface was requested or the requested address was not local. § NetworkDown 🔬 This is a nightly-only experimental API. ( core_io #154046 ) The system’s networking is down. § BrokenPipe 🔬 This is a nightly-only experimental API. ( core_io #154046 ) The operation failed because a pipe was closed. § AlreadyExists 🔬 This is a nightly-only experimental API. ( core_io #154046 ) An entity already exists, often a file. § WouldBlock 🔬 This is a nightly-only experimental API. ( core_io #154046 ) The operation needs to block to complete, but the blocking operation was requested to not occur. § NotADirectory 🔬 This is a nightly-only experimental API. ( core_io #154046 ) A filesystem object is, unexpectedly, not a directory.

For example, a filesystem path was specified where one of the intermediate directory components was, in fact, a plain file. § IsADirectory 🔬 This is a nightly-only experimental API. ( core_io #154046 ) The filesystem object is, unexpectedly, a directory. A directory was specified when a non-directory was expected. § DirectoryNotEmpty 🔬 This is a nightly-only experimental API. ( core_io #154046 ) A non-empty directory was specified where an empty directory was expected. § ReadOnlyFilesystem 🔬 This is a nightly-only experimental API. ( core_io #154046 ) The filesystem or storage medium is read-only, but a write operation was attempted. § FilesystemLoop 🔬 This is a nightly-only experimental API. ( io_error_more #86442 ) Loop in the filesystem or IO subsystem; often, too many levels of symbolic links.

There was a loop (or excessively long chain) resolving a filesystem object or file IO object. On Unix this is usually the result of a symbolic link loop; or, of exceeding the system-specific limit on the depth of symlink traversal. § StaleNetworkFileHandle 🔬 This is a nightly-only experimental API. ( core_io #154046 ) Stale network file handle. With some network filesystems, notably NFS, an open file (or directory) can be invalidated by problems with the network or server. § InvalidInput 🔬 This is a nightly-only experimental API. ( core_io #154046 ) A parameter was incorrect. § InvalidData 🔬 This is a nightly-only experimental API. ( core_io #154046 ) Data not valid for the operation were encountered.

Unlike InvalidInput , this typically means that the operation parameters were valid, however the error was caused by malformed input data. For example, a function that reads a file into a string will error with InvalidData if the file’s contents are not valid UTF-8. § TimedOut 🔬 This is a nightly-only experimental API. ( core_io #154046 ) The I/O operation’s timeout expired, causing it to be canceled. § WriteZero 🔬 This is a nightly-only experimental API. ( core_io #154046 ) An error returned when an operation could not be completed because a call to write returned Ok(0) .

This typically means that an operation could only succeed if it wrote a particular number of bytes but only a smaller number of bytes could be written. § StorageFull 🔬 This is a nightly-only experimental API. ( core_io #154046 ) The underlying storage (typically, a filesystem) is full. This does not include out of quota errors. § NotSeekable 🔬 This is a nightly-only experimental API. ( core_io #154046 ) Seek on unseekable file.

Seeking was attempted on an open file handle which is not suitable for seeking - for example, on Unix, a named pipe opened with File::open . § QuotaExceeded 🔬 This is a nightly-only experimental API. ( core_io #154046 ) Filesystem quota or some other kind of quota was exceeded. § FileTooLarge 🔬 This is a nightly-only experimental API. ( core_io #154046 ) File larger than allowed or supported. This might arise from a hard limit of the underlying filesystem or file access API, or from an administratively imposed resource limitation.

Simple disk full, and out of quota, have their own errors. § ResourceBusy 🔬 This is a nightly-only experimental API. ( core_io #154046 ) Resource is busy. § ExecutableFileBusy 🔬 This is a nightly-only experimental API. ( core_io #154046 ) Executable file is busy. An attempt was made to write to a file which is also in use as a running program. (Not all operating systems detect this situation.) § Deadlock 🔬 This is a nightly-only experimental API. ( core_io #154046 ) Deadlock (avoided).

A file locking operation would result in deadlock. This situation is typically detected, if at all, on a best-effort basis. § CrossesDevices 🔬 This is a nightly-only experimental API. ( core_io #154046 ) Cross-device or cross-filesystem (hard) link or rename. § TooManyLinks 🔬 This is a

The rest of this page is on the live site.