{"id":"948346a1a1fdd7ea","repo":"docker/cli","slug":"failed-to-wait-on-tasks-of-stack-s-w","errorCode":null,"errorMessage":"failed to wait on tasks of stack: %s: %w","messagePattern":"failed to wait on tasks of stack: (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/command/stack/remove.go","lineNumber":92,"sourceCode":"\t\t\t_, _ = fmt.Fprintln(dockerCli.Err(), \"Nothing found in stack:\", namespace)\n\t\t\tcontinue\n\t\t}\n\n\t\t// TODO(thaJeztah): change this \"hasError\" boolean to return a (multi-)error for each of these functions instead.\n\t\thasError := removeServices(ctx, dockerCli, services.Items)\n\t\thasError = removeSecrets(ctx, dockerCli, secrets.Items) || hasError\n\t\thasError = removeConfigs(ctx, dockerCli, configs.Items) || hasError\n\t\thasError = removeNetworks(ctx, dockerCli, networks.Items) || hasError\n\n\t\tif hasError {\n\t\t\terrs = append(errs, errors.New(\"failed to remove some resources from stack: \"+namespace))\n\t\t\tcontinue\n\t\t}\n\n\t\tif !opts.detach {\n\t\t\terr = waitOnTasks(ctx, apiClient, namespace)\n\t\t\tif err != nil {\n\t\t\t\terrs = append(errs, fmt.Errorf(\"failed to wait on tasks of stack: %s: %w\", namespace, err))\n\t\t\t}\n\t\t}\n\t}\n\treturn errors.Join(errs...)\n}\n\nfunc sortServiceByName(services []swarm.Service) func(i, j int) bool {\n\treturn func(i, j int) bool {\n\t\treturn services[i].Spec.Name < services[j].Spec.Name\n\t}\n}\n\nfunc removeServices(ctx context.Context, dockerCLI command.Cli, services []swarm.Service) bool {\n\tvar hasError bool\n\tsort.Slice(services, sortServiceByName(services))\n\tfor _, service := range services {\n\t\t_, _ = fmt.Fprintln(dockerCLI.Out(), \"Removing service\", service.Spec.Name)\n\t\tif _, err := dockerCLI.Client().ServiceRemove(ctx, service.ID, client.ServiceRemoveOptions{}); err != nil {","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/command/stack/remove.go#L74-L110","documentation":"Error \"failed to wait on tasks of stack: %s: %w\" thrown in docker/cli.","triggerScenarios":"Thrown at cli/command/stack/remove.go:92 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"e9452d6e785f6e365712b9d71bd7517591773c86","analyzedAt":"2026-08-01T07:09:22.474Z","schemaVersion":2}