{"record":{"id":"2e3400ceed8eb48a","repo":"hashicorp/nomad","slug":"error-creating-fifo-w","errorCode":null,"errorMessage":"error creating fifo: %w","messagePattern":"error creating fifo: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/lib/fifo/mkfifo_unix.go","lineNumber":18,"sourceCode":"// Copyright IBM Corp. 2015, 2026\n// SPDX-License-Identifier: BUSL-1.1\n\n//go:build !linux && !freebsd && !netbsd && !openbsd && !windows\n\npackage fifo\n\nimport (\n\t\"fmt\"\n\n\t\"golang.org/x/sys/unix\"\n)\n\nfunc mkfifo(path string, mode uint32) (err error) {\n\t// macOS doesn't support mkfifoat\n\terr = unix.Mkfifo(path, mode)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error creating fifo: %w\", err)\n\t}\n\treturn nil\n}\n","sourceCodeStart":1,"sourceCodeEnd":22,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/client/lib/fifo/mkfifo_unix.go#L1-L22","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nif err := fifo.Create(path, 0o600); err != nil { return err }\n// after\nif err := fifo.Create(path, 0o600); err != nil && !errors.Is(err, os.ErrExist) { return err }","handlingStrategy":"try-catch","validationCode":"if fi, err := os.Stat(path); err == nil {\n\treturn fmt.Errorf(\"path %s already exists (%v)\", path, fi.Mode())\n}","typeGuard":null,"tryCatchPattern":"err := fifo.Create(path, 0o600)\nif err != nil && !errors.Is(err, os.ErrExist) {\n\treturn err\n}","preventionTips":["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"],"tags":["go","unix","fifo","syscall"],"backgroundTag":"fifo-create-failed","analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}