Linux system errors
File Exists
Reviewed for reference consistency: August 11, 2026
a create-with-exclusivity request collided with a name that is already there
What 17 Means
The 17 error on the Linux system errors indicates file exists — a create-with-exclusivity request collided with a name that is already there. This typically occurs due to mkdir or a create call with the exclusivity flag meeting an existing target.
Exit code 17 corresponds to EEXIST, 'File exists'. The errno only appears on demand: plain creation overwrites or merges happily, so EEXIST arises when the caller explicitly demanded exclusivity — create this only if it does not exist. The kernel found the name occupied and reported the collision instead of guessing.
How to fix 17
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.
Look at the colliding name
A long listing of the target shows whether the existing entry is a file, directory, or link — and its timestamps suggest who created it.
ls -ld /path/to/targetTest existence before exclusive creation
A shell existence test makes rerunnable scripts skip the creation step instead of colliding with their own earlier output.
[ -e /path/to/target ] && echo present || echo absent
Technical Background
EEXIST appears only when the caller demanded exclusivity. Creation interfaces have two moods: best-effort, which tolerates whatever exists, and exclusive, which promises the caller that a successful return means 'you created it, no one else'. The exclusive mood is what turns EEXIST from noise into information.
That information powers real coordination. A lockfile is nothing more than an exclusive create used as a race gate: two workers attempt the same create, exactly one succeeds, and the loser receives errno 17 as the formal notice that it arrived second. Distributed-looking behavior from a single, ordinary syscall.
The accidental form is the rerun problem: setup scripts and provisioners that create unconditionally on first pass collide with their own output on the second. The collision is the system working correctly — the state is simply already in place.
Common Causes
- mkdir or a create call with the exclusivity flag meeting an existing target
- Two workers racing to create the same lockfile or atomic marker
- An idempotent setup script re-running over state from its previous execution
Typical Scenarios
- A directory-creation step in a setup script failing on the second run because the directory already exists
- A scheduler launching two job instances that race to claim the same lockfile
- A hard-link or FIFO creation refusing to clobber a name the caller marked as exclusive
What to Know
The check is a single observation: does the target name exist, and if so, who created it. For race-gate designs the collision is expected; for idempotent scripts the remedy is checking existence before claiming exclusivity.
Frequently Asked Questions
Common questions about Linux 17 error
No — it is often the designed signal. Lockfiles and atomic claim patterns use exclusive creation deliberately, where a successful create means 'you won the race' and EEXIST means 'someone else got there first'. Both outcomes are correct behavior.
A directory is a namespace entry, and silently replacing one would orphan the entries inside the original. Creation calls that could destroy existing state refuse by default; exclusivity is the safe semantics.
17 (EEXIST) is about collision — the name is taken. 21 (EISDIR) is about misuse — a directory was targeted with a file-only operation. One says 'already there', the other says 'wrong kind of target'.
Related Error Codes
Permission Denied — the process does not have permission to access the resource
Invalid Argument — a syscall received a malformed or self-contradictory parameter
Not a Directory — a path walks through a component that is an ordinary file
Is a Directory — a file-level write or open was aimed at a directory
Related Errors From Other Categories
Similar error codes documented across different platforms and systems
You have unresolved file conflicts preventing Git from completing the current operation.
You tried to add a remote named 'origin', but one with that name already exists.
Git does not know which remote branch should receive your pushed commits.
You checked out a specific commit, detaching your working directory from the branch history.