docker/cli · warning

nothing found in stack

Error message

nothing found in stack: %s

What it means

Returned by runPS when `docker stack ps <stack>` finds zero tasks. The TaskList query (filtered by the stack namespace label) returns no items, indicating either the stack name is wrong, the stack has no services/tasks, or the tasks were already cleaned up.

Solutions

  1. Confirm the stack name with `docker stack ls`.
  2. Verify the stack has services: `docker stack services <name>`.
  3. If the stack was removed, there are no tasks to list by design.
  4. Check spelling and that you're targeting the right Swarm/manager.

Example fix

// before
docker stack ps mystak   # typo
// after
docker stack ls            # find the real name
docker stack ps mystack
Defensive patterns

Strategy: validation

Validate before calling

// Pre-check: confirm a stack has tasks before listing
svcs, err := getStackServices(ctx, c, namespace)
if err != nil { return err }
if len(svcs.Items) == 0 {
    return fmt.Errorf("no services in stack %q; nothing to list", namespace)
}

Try / catch

err := runPS(ctx, cli, opts)
if err != nil && strings.Contains(err.Error(), "nothing found in stack") {
    // treat as non-fatal empty result, not a hard error
    return nil
}

Prevention

When it happens

Trigger: Running `docker stack ps <name>` where no tasks carry the com.docker.stack.namespace=<name> label. The check at ps.go:63 returns this error (not a daemon failure, but an empty result).

Common situations: Typo in the stack name; querying a stack that was never deployed or already removed; the stack's services have no running tasks (all removed); querying too early before tasks are scheduled.

Related errors


AI-assisted analysis of docker/cli@4f84911bfe (2026-08-07). Data as JSON: /api/errors/d91f0a32b86a45a0. Report an issue: GitHub.

Appendix: source

Thrown at cli/command/stack/ps.go:64

	flags.BoolVar(&opts.noResolve, "no-resolve", false, "Do not map IDs to Names")
	flags.VarP(&opts.filter, "filter", "f", "Filter output based on conditions provided")
	flags.BoolVarP(&opts.quiet, "quiet", "q", false, "Only display task IDs")
	flags.StringVar(&opts.format, "format", "", flagsHelper.FormatHelp)
	return cmd
}

// runPS is the swarm implementation of docker stack ps
func runPS(ctx context.Context, dockerCLI command.Cli, opts psOptions) error {
	apiClient := dockerCLI.Client()
	res, err := apiClient.TaskList(ctx, client.TaskListOptions{
		Filters: getStackFilterFromOpt(opts.namespace, opts.filter),
	})
	if err != nil {
		return err
	}

	if len(res.Items) == 0 {
		return fmt.Errorf("nothing found in stack: %s", opts.namespace)
	}

	if opts.format == "" {
		opts.format = task.DefaultFormat(dockerCLI.ConfigFile(), opts.quiet)
	}

	return task.Print(ctx, dockerCLI, res, idresolver.New(apiClient, opts.noResolve), !opts.noTrunc, opts.quiet, opts.format)
}

View on GitHub (pinned to 4f84911bfe)