hashicorp/nomad · error
error creating fifo: %w
Error message
error creating fifo: %w
What it means
The final step of the mkfifoat-based creation calls unix.Mkfifoat with the parent directory's FD to create the FIFO relative to that directory. This error wraps any Mkfifoat failure: EEXIST (FIFO already there), ENOENT/EACCES on the base name, ENAMETOOLONG, or unsupported filesystem.
Source
Thrown at client/lib/fifo/mkfifoat.go:36
base := filepath.Base(path)
root, err := os.OpenRoot(dir)
if err != nil {
return fmt.Errorf("error opening fifo parent directory %q: %v", dir, err)
}
defer root.Close()
parent, err := root.Open(".")
if err != nil {
return fmt.Errorf("error getting file handle to fifo parent directory %q: %v", dir, err)
}
defer parent.Close()
// os.Root doesn't support creating a FIFO, so we need to drop to the
// syscall and grab the parent's FD
err = unix.Mkfifoat(int(parent.Fd()), base, mode)
if err != nil {
return fmt.Errorf("error creating fifo: %w", err)
}
return nil
}
View on GitHub (pinned to 482b49bf1a)
Solutions
- Ignore os.ErrExist if concurrent creation is expected: errors.Is(err, os.ErrExist)
- Remove stale FIFOs with fifo.Remove before creating
- Shorten the FIFO path/name if ENAMETOOLONG
- Create FIFOs on a local filesystem that supports them (tmpfs/local disk), not unsupported network FS
Example fix
// before
if err := fifo.Create(path, 0o600); err != nil { return err }
// after
if err := fifo.Create(path, 0o600); err != nil && !errors.Is(err, os.ErrExist) { return err } Defensive patterns
Strategy: try-catch
Validate before calling
if len(filepath.Base(path)) > 255 {
return fmt.Errorf("fifo base name too long")
}
if _, err := os.Stat(path); err == nil {
return fmt.Errorf("fifo %s already exists", path)
} Try / catch
err := fifo.Create(path, mode)
if err != nil && !errors.Is(err, os.ErrExist) {
return fmt.Errorf("create fifo %s: %w", path, err)
} Prevention
- Treat os.ErrExist as success for idempotent creation
- Keep fifo names short (NAME_MAX limits)
- fifo.Remove leftovers from previous runs
- Use a filesystem that supports FIFOs (local disk/tmpfs)
When it happens
Trigger: Calling fifo.Create(path, mode) when the FIFO already exists at path, the base name is too long or invalid, permissions deny creation, or the filesystem (e.g. some network/overlay FS) does not support FIFOs.
Common situations: Double-creation of a FIFO during concurrent IO setup; FIFOs left over from a prior container run; extremely long pipe names exceeding NAME_MAX; creating FIFOs on filesystems like certain NFS mounts that disallow special files.
Related errors
- error creating fifo: %w
- error opening fifo parent directory %q: %v
- error getting file handle to fifo parent directory %q: %v
- error creating fifo %v: %w
- error opening fifo parent directory %q: %w
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/378280bdf026c906.
Report an issue: GitHub.