ErrorKind::Other
RustERRORNotableI/O

Other OS error

Quick Answer

Inspect e.raw_os_error() for the specific OS code and consult platform docs.

What this means

A catch-all variant for OS errors not mapped to a specific ErrorKind. Contains the raw OS error code.

Why it happens
  1. 1OS returned an error code with no matching ErrorKind variant
  2. 2Manually constructed with Error::new(ErrorKind::Other, ...)

Fix

Inspect the raw OS error

Inspect the raw OS error
if let Some(os_code) = err.raw_os_error() {
    eprintln!("OS error {}: {}", os_code, err);
}

Why this works

raw_os_error() surfaces the underlying errno or Windows error code.

Code examples
Constructrust
use std::io::{Error, ErrorKind};
let e = Error::new(ErrorKind::Other, "custom error");
Sources

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All Rust errors