{"record":{"id":"378280bdf026c906","repo":"hashicorp/nomad","slug":"error-creating-fifo-w-378280","errorCode":null,"errorMessage":"error creating fifo: %w","messagePattern":"error creating fifo: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/lib/fifo/mkfifoat.go","lineNumber":36,"sourceCode":"\tbase := filepath.Base(path)\n\n\troot, err := os.OpenRoot(dir)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error opening fifo parent directory %q: %v\", dir, err)\n\t}\n\tdefer root.Close()\n\n\tparent, err := root.Open(\".\")\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error getting file handle to fifo parent directory %q: %v\", dir, err)\n\t}\n\tdefer parent.Close()\n\n\t// os.Root doesn't support creating a FIFO, so we need to drop to the\n\t// syscall and grab the parent's FD\n\terr = unix.Mkfifoat(int(parent.Fd()), base, mode)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error creating fifo: %w\", err)\n\t}\n\treturn nil\n}\n","sourceCodeStart":18,"sourceCodeEnd":40,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/client/lib/fifo/mkfifoat.go#L18-L40","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"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 len(filepath.Base(path)) > 255 {\n\treturn fmt.Errorf(\"fifo base name too long\")\n}\nif _, err := os.Stat(path); err == nil {\n\treturn fmt.Errorf(\"fifo %s already exists\", path)\n}","typeGuard":null,"tryCatchPattern":"err := fifo.Create(path, mode)\nif err != nil && !errors.Is(err, os.ErrExist) {\n\treturn fmt.Errorf(\"create fifo %s: %w\", path, err)\n}","preventionTips":["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)"],"tags":["go","linux","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"}