docker/cli · error

invalid npipe source, source cannot be empty

Error message

invalid npipe source, source cannot be empty

What it means

Raised by handleNpipeToMount when a `type: npipe` (Windows named pipe) service volume has an empty `source`. An npipe mount forwards a specific host named pipe (e.g. \\.\pipe\docker_engine) into the container, so the source pipe path is mandatory.

Source

Thrown at cli/compose/convert/volume.go:176

	if volume.Image != nil {
		return mount.Mount{}, errors.New("image options are incompatible with type tmpfs")
	}
	if volume.Cluster != nil {
		return mount.Mount{}, errors.New("cluster options are incompatible with type tmpfs")
	}
	if volume.Tmpfs != nil {
		result.TmpfsOptions = &mount.TmpfsOptions{
			SizeBytes: volume.Tmpfs.Size,
		}
	}
	return result, nil
}

func handleNpipeToMount(volume composetypes.ServiceVolumeConfig) (mount.Mount, error) {
	result := createMountFromVolume(volume)

	if volume.Source == "" {
		return mount.Mount{}, errors.New("invalid npipe source, source cannot be empty")
	}
	if volume.Volume != nil {
		return mount.Mount{}, errors.New("volume options are incompatible with type npipe")
	}
	if volume.Image != nil {
		return mount.Mount{}, errors.New("image options are incompatible with type npipe")
	}
	if volume.Tmpfs != nil {
		return mount.Mount{}, errors.New("tmpfs options are incompatible with type npipe")
	}
	if volume.Bind != nil {
		result.BindOptions = &mount.BindOptions{
			Propagation: mount.Propagation(volume.Bind.Propagation),
		}
	}
	return result, nil
}

View on GitHub (pinned to e9452d6e78)

Solutions

  1. Add the host named-pipe path as `source:`, e.g. `source: \\.\pipe\docker_engine`
  2. Check that any environment variable used for the source is actually set at deploy time

Example fix

# before
volumes:
  - type: npipe
    target: \\.\pipe\docker_engine
# after
volumes:
  - type: npipe
    source: \\.\pipe\docker_engine
    target: \\.\pipe\docker_engine

When it happens

Trigger: ServiceVolumeConfig with Type npipe and Source == "" during `docker stack deploy` conversion — e.g. long-syntax entry with only `target:` set.

Common situations: Windows containers mounting the Docker engine pipe but omitting `source:`; templated compose files where the source variable expands to empty; confusing npipe with tmpfs (which requires an empty source).

Related errors


AI-assisted analysis of docker/cli@e9452d6e78 (2026-08-01). Data as JSON: /data/errors/5b137e585825652b.json. Report an issue: GitHub.