hashicorp/nomad · error
error creating fifo: %w
Error message
error creating fifo: %w
What it means
mkfifo creates a POSIX FIFO with unix.Mkfifo. This error wraps any failure of the Mkfifo syscall, most commonly EEXIST (a file already exists at the path), ENOENT (parent directory missing), or EACCES. Callers pass the wrapped error up through fifo.Create.
Source
Thrown at client/lib/fifo/mkfifo_unix.go:18
// Copyright IBM Corp. 2015, 2026
// SPDX-License-Identifier: BUSL-1.1
//go:build !linux && !freebsd && !netbsd && !openbsd && !windows
package fifo
import (
"fmt"
"golang.org/x/sys/unix"
)
func mkfifo(path string, mode uint32) (err error) {
// macOS doesn't support mkfifoat
err = unix.Mkfifo(path, mode)
if err != nil {
return fmt.Errorf("error creating fifo: %w", err)
}
return nil
}
View on GitHub (pinned to 482b49bf1a)
Solutions
- Treat os.ErrExist as acceptable: check errors.Is(err, os.ErrExist) and continue
- Remove any stale FIFO with fifo.Remove before creating
- Create the parent directory first (os.MkdirAll)
- Verify write permission on the parent directory and that the filesystem supports FIFOs
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 fi, err := os.Stat(path); err == nil {
return fmt.Errorf("path %s already exists (%v)", path, fi.Mode())
} Try / catch
err := fifo.Create(path, 0o600)
if err != nil && !errors.Is(err, os.ErrExist) {
return err
} Prevention
- Tolerate os.ErrExist when creation is idempotent
- fifo.Remove stale fifos before creating
- os.MkdirAll the parent directory first
- Ensure the target filesystem supports FIFOs
When it happens
Trigger: Calling fifo.Create (which routes to this mkfifo on platforms without mkfifoat, e.g. macOS) when the FIFO already exists, the parent directory does not exist, or permissions deny creation.
Common situations: Re-creating a FIFO from a previous run without removing the old one; wrong path with missing parent dir; read-only filesystem; macOS where mkfifoat is unsupported so this plain-Mkfifo variant is used.
Related errors
- error creating fifo: %w
- error opening reader at %s: %w
- error opening writer at %s: %w
- error opening root dir %q: %w
- error opening fifo parent directory %q: %v
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/2e3400ceed8eb48a.
Report an issue: GitHub.