Linux system errors
Invalid Argument
Reviewed for reference consistency: August 11, 2026
a syscall received a malformed or self-contradictory parameter
What 22 Means
The 22 error on the Linux system errors indicates invalid argument — a syscall received a malformed or self-contradictory parameter. This typically occurs due to a flag combination the syscall does not allow together.
Exit code 22 corresponds to EINVAL, 'Invalid argument'. It is the syscall layer's generic rejection: the request itself is malformed, independent of system state. The file may exist, the device may be idle, the network may be perfect — none of it matters, because the arguments as given cannot be honored by anyone.
How to fix 22
General informational guidance, not professional advice. Commands can affect your system or data — back up first and proceed at your own risk. FixerCode is an independent reference, not affiliated with any vendor mentioned.
Capture the failing call's arguments
A syscall trace lists every call with its parameters; the one returning EINVAL identifies both the interface and the offending value.
strace -o trace.log ./your_program || grep -i inval trace.logRead the interface's accepted parameters
The manual section for the syscall (section 2) documents each argument's domain and flag rules, the contract EINVAL enforces.
man 2 open
Technical Background
EINVAL judges the request itself. Every other errno so far involves the world's state — a missing device, a busy mount, a closed pipe. Errno 22 ignores the world: the arguments, as stated, contradict the syscall's contract, and no arrangement of external circumstances can make them valid.
The breadth of that contract is why EINVAL is everywhere. Syscalls take flags, sizes, alignment promises, structure layouts, and mutual exclusions; violating any one yields the same errno. An ioctl with a request code the driver never implemented, a length of zero where one is required, two flags that cannot coexist — all land on exit 22.
Kernel evolution adds a temporal twist. Parameter domains shift between versions: a value accepted by one kernel release is rejected by the next, so identical code can start returning EINVAL after an update with no change on the application side.
Common Causes
- A flag combination the syscall does not allow together
- A value outside the parameter's accepted domain (size, alignment, range)
- A structure or buffer parameter misused — wrong size, wrong type field, stale handle
Typical Scenarios
- An ioctl called with a request code the target device does not implement
- A size or length parameter passed as zero or negative where a positive value is required
- A kernel-tuning call receiving a value outside the accepted range on this kernel version
What to Know
The failing syscall and its exact arguments are the diagnosis; a syscall trace names both. From there, the accepted domain of the offending parameter on this specific kernel answers why the value was rejected.
Frequently Asked Questions
Common questions about Linux 22 error
It is the shared rejection code for every malformed request across thousands of syscalls — a design economy, not a diagnosis. The specific argument at fault comes from the call itself, which a syscall trace names directly.
Error 22 (EINVAL) rejects the value or shape of the argument itself; error 14 (EFAULT) accepts the argument's meaning but fails to reach the memory it points at. A negative length is EINVAL; a sane length pointing into unmapped memory is EFAULT.
Yes — kernel updates tighten or widen accepted parameter domains, and hardware varies by driver. A call valid on one machine can be EINVAL on another with the same userland but a different kernel or device.
Related Error Codes
Bad File Descriptor — the descriptor number is not open in this process's table
Bad Address — the kernel could not reach the user-space buffer a syscall pointed at
No Such Device — the operation targets hardware or a driver that is not present
Too Many Open Files — the process hit its per-process descriptor ceiling
Related Errors From Other Categories
Similar error codes documented across different platforms and systems
Git paused the merge because it cannot automatically resolve overlapping changes.
Git aborted the merge to protect uncommitted changes in your working directory.
Git prevented a branch switch because it would overwrite unsaved changes in your working directory.
Git aborted the merge because it would overwrite untracked files in your working directory.