Home

EEXIST

EEXIST is an error code used in POSIX-compliant systems to indicate that a target already exists when an operation requires it not to exist. It is exposed as errno.EEXIST in many programming environments, such as C and languages that mirror POSIX errno values.

The numeric value of EEXIST is typically 17 on most Unix-like systems, but the exact value is

Common contexts where EEXIST is returned include attempts to create something at a path that already exists

EEXIST is distinct from EISDIR, which signals that the existing target is a directory and cannot be

In practice, programs use EEXIST to implement exclusive or idempotent behavior, to detect conflicts when creating

implementation-defined
and
may
vary
across
platforms.
with
an
exclusive
creation
flag.
For
example,
opening
a
file
with
O_CREAT|O_EXCL
when
the
file
already
exists
often
yields
EEXIST.
Creating
a
directory
with
mkdir
when
a
directory
already
exists
at
the
path
can
also
return
EEXIST
on
many
systems.
Similarly,
attempting
to
create
a
hard
link
or
a
symbolic
link
where
the
destination
path
is
already
taken
can
yield
EEXIST,
depending
on
the
operation.
used
for
a
given
operation.
It
is
also
considered
in
the
broader
category
of
I/O
errors
returned
by
system
calls
and
libraries.
new
resources,
and
to
decide
whether
to
reuse
an
existing
resource
or
report
a
controlled
error
to
the
caller.
Cross-language
code
often
checks
for
EEXIST
via
the
language’s
errno
or
error-handling
facilities.