hashicorp/nomad · error

failed to create fifo: %v

Error message

failed to create fifo: %v

What it means

On Windows, FIFOs are named pipes. CreateAndRead creates a named pipe server with winio.ListenPipe and returns a function that produces read ends. This error wraps a failure of ListenPipe, so the pipe server could not be created at all.

Source

Thrown at client/lib/fifo/fifo_windows.go:90

func (f *winFIFO) Close() error {
	f.connLock.Lock()
	if f.conn != nil {
		f.conn.Close()
	}
	f.connLock.Unlock()
	return f.listener.Close()
}

// CreateAndRead creates a fifo at the given path and returns an io.ReadCloser open for it.
// The fifo must not already exist
func CreateAndRead(path string) (func() (io.ReadCloser, error), error) {
	l, err := winio.ListenPipe(path, &winio.PipeConfig{
		InputBufferSize:  PipeBufferSize,
		OutputBufferSize: PipeBufferSize,
	})
	if err != nil {
		return nil, fmt.Errorf("failed to create fifo: %v", err)
	}

	return func() (io.ReadCloser, error) {
		return &winFIFO{
			listener: l,
		}, nil
	}, nil
}

func OpenReader(path string) (io.ReadCloser, error) {
	l, err := winio.ListenOnlyPipe(path, nil)
	if err != nil {
		return nil, fmt.Errorf("failed to open fifo listener: %v", err)
	}

	return &winFIFO{listener: l}, nil
}

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Use a valid named pipe path of the form \\.\pipe\<name>
  2. Ensure no other listener holds the same pipe name; close leaked pipes or pick a unique name
  3. Check that the user/service account can create named pipes (SeCreateNamedPipePrivilege)
  4. Close prior CreateAndRead listeners before creating again

Example fix

// before
r, err := fifo.CreateAndRead("mylogpipe")
// after
r, err := fifo.CreateAndRead(`\\.\pipe\containerd-logs-mylogpipe`)
Defensive patterns

Strategy: try-catch

Validate before calling

if !strings.HasPrefix(path, `\\.\pipe\`) {
	return fmt.Errorf("invalid named pipe path: %s", path)
}

Try / catch

r, err := fifo.CreateAndRead(pipePath)
if err != nil {
	// pipe name may be in use; retry with unique name or after cleanup
	return fmt.Errorf("create pipe %s: %w", pipePath, err)
}

Prevention

When it happens

Trigger: Calling fifo.CreateAndRead(path) with an invalid named-pipe path (must be \\.\pipe\...), a pipe with the same name already existing, or the pipe namespace being inaccessible.

Common situations: Path not in the \\.\pipe\ namespace; another process (or a leaked prior instance) already owns the pipe name; running in an environment (containers, restricted service accounts) where named pipe creation is denied.

Related errors


AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04). Data as JSON: /api/errors/8390f1d417baba68. Report an issue: GitHub.