EINVAL
Linux / POSIXERRORCommonValidationHIGH confidence

Invalid Argument

What this means

An invalid argument was passed to a system call. The value is out of range, the flag combination is not supported, or the argument violates a precondition of the system call. EINVAL is a general-purpose validation error used across many syscalls.

Why it happens
  1. 1Passing an out-of-range value such as a negative file size or invalid signal number.
  2. 2Using an unsupported combination of flags for a system call.
  3. 3Passing a null pointer where a valid pointer is required.
  4. 4Using an invalid socket address family or protocol option value.
How to reproduce

Passing an invalid signal number to kill.

trigger — this will error
trigger — this will error
$ kill -999 1
bash: kill: 999: invalid signal specification

expected output

bash: kill: 999: invalid signal specification

Fix

Consult the man page for valid argument ranges

WHEN When an EINVAL is unexpected and the arguments look correct

Consult the man page for valid argument ranges
$ man 2 ioctl   # Check valid ioctl requests
$ man 7 socket  # Check valid socket options

Why this works

System call man pages list all valid argument values and flag combinations in their ERRORS section.

Sources
Official documentation ↗

Linux Programmer Manual errno(3)

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

← All Linux / POSIX errors