docker/cli ยท error

no such task or service: %v

Error message

no such task or service: %v

What it means

Error "no such task or service: %v" thrown in docker/cli.

Source

Thrown at cli/command/service/logs.go:93

	var (
		maxLength    = 1
		responseBody io.ReadCloser
		tty          bool
	)

	service, err := apiClient.ServiceInspect(ctx, opts.target, client.ServiceInspectOptions{})
	if err != nil {
		// if it's any error other than service not found, it's Real
		if !errdefs.IsNotFound(err) {
			return err
		}
		res, err := apiClient.TaskInspect(ctx, opts.target, client.TaskInspectOptions{})
		if err != nil {
			if errdefs.IsNotFound(err) {
				// if the task isn't found, rewrite the error to be clear
				// that we looked for services AND tasks and found none
				err = fmt.Errorf("no such task or service: %v", opts.target)
			}
			return err
		}

		tty = res.Task.Spec.ContainerSpec.TTY
		maxLength = getMaxLength(res.Task.Slot)

		// we can't prettify tty logs. tell the user that this is the case.
		// this is why we assign the logs function to a variable and delay calling
		// it. we want to check this before we make the call and checking twice in
		// each branch is even sloppier than this CLI disaster already is
		if tty && !opts.raw {
			return errors.New("tty service logs only supported with --raw")
		}

		// now get the logs
		responseBody, err = apiClient.TaskLogs(ctx, opts.target, client.TaskLogsOptions{
			ShowStdout: true,

View on GitHub (pinned to e9452d6e78)

When it happens

Trigger: Thrown at cli/command/service/logs.go:93 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/ac3cc73611901df3.json. Report an issue: GitHub.