docker/cli ยท error

no such network: %s

Error message

no such network: %s

What it means

Error "no such network: %s" thrown in docker/cli.

Source

Thrown at cli/command/service/inspect.go:74

	if opts.pretty {
		opts.format = "pretty"
	}

	getRef := func(ref string) (any, []byte, error) {
		// Service inspect shows defaults values in empty fields.
		res, err := apiClient.ServiceInspect(ctx, ref, client.ServiceInspectOptions{InsertDefaults: true})
		if err == nil || !errdefs.IsNotFound(err) {
			return res.Service, res.Raw, err
		}
		return nil, nil, fmt.Errorf("no such service: %s", ref)
	}

	getNetwork := func(ref string) (any, []byte, error) {
		res, err := apiClient.NetworkInspect(ctx, ref, client.NetworkInspectOptions{Scope: "swarm"})
		if err == nil || !errdefs.IsNotFound(err) {
			return res.Network, res.Raw, err
		}
		return nil, nil, fmt.Errorf("no such network: %s", ref)
	}

	f := opts.format
	if len(f) == 0 {
		f = "raw"
		if len(dockerCLI.ConfigFile().ServiceInspectFormat) > 0 {
			f = dockerCLI.ConfigFile().ServiceInspectFormat
		}
	}

	// check if the user is trying to apply a template to the pretty format, which
	// is not supported
	if strings.HasPrefix(f, "pretty") && f != "pretty" {
		return errors.New("cannot supply extra formatting options to the pretty template")
	}

	serviceCtx := formatter.Context{
		Output: dockerCLI.Out(),

View on GitHub (pinned to e9452d6e78)

When it happens

Trigger: Thrown at cli/command/service/inspect.go:74 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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