hashicorp/nomad · error

failed to open fifo listener: %v

Error message

failed to open fifo listener: %v

What it means

On Windows, OpenReader creates a listen-only named pipe server via winio.ListenOnlyPipe. This error is returned when ListenOnlyPipe fails, i.e. the pipe server could not be established for the given name.

Source

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

	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
}

// OpenWriter opens a fifo that already exists and returns an io.WriteCloser for it
func OpenWriter(path string) (io.WriteCloser, error) {
	return winio.DialPipe(path, nil)
}

// Remove a fifo that already exists at a given path
func Remove(path string) error {
	dur := 500 * time.Millisecond
	conn, err := winio.DialPipe(path, &dur)
	if err == nil {
		return conn.Close()
	}

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Use a unique, correctly formatted \\.\pipe\<name> path
  2. Ensure the previous listener is closed before reopening the same name
  3. Run under an account permitted to create named pipes
  4. Retry with a fresh pipe name if the old name is leaked

Example fix

// before
r, err := fifo.OpenReader(`\\.\pipe\logs`)
// after
r, err := fifo.OpenReader(fmt.Sprintf(`\\.\pipe\containerd-logs-%d`, os.Getpid()))
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.OpenReader(pipePath)
if err != nil {
	// name collision or stale listener; retry with backoff or new name
	return fmt.Errorf("open pipe listener %s: %w", pipePath, err)
}

Prevention

When it happens

Trigger: Calling fifo.OpenReader(path) with a malformed pipe path, a name already in use by another pipe server, or insufficient privileges to create a named pipe.

Common situations: Two log consumers opening the same pipe name simultaneously; stale pipe server from a crashed process still registered; path missing the \\.\pipe\ prefix; restricted container/service context denying pipe creation.

Related errors


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