{"id":"5bb4bbc6f686be1e","repo":"docker/cli","slug":"failed-to-get-tasks-w","errorCode":null,"errorMessage":"failed to get tasks: %w","messagePattern":"failed to get tasks: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/command/stack/remove.go","lineNumber":179,"sourceCode":"\tswarm.TaskStateReady:     7,\n\tswarm.TaskStateStarting:  8,\n\tswarm.TaskStateRunning:   9,\n\tswarm.TaskStateComplete:  10,\n\tswarm.TaskStateShutdown:  11,\n\tswarm.TaskStateFailed:    12,\n\tswarm.TaskStateRejected:  13,\n}\n\nfunc terminalState(state swarm.TaskState) bool {\n\treturn numberedStates[state] > numberedStates[swarm.TaskStateRunning]\n}\n\nfunc waitOnTasks(ctx context.Context, apiClient client.APIClient, namespace string) error {\n\tterminalStatesReached := 0\n\tfor {\n\t\tres, err := getStackTasks(ctx, apiClient, namespace)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to get tasks: %w\", err)\n\t\t}\n\n\t\tfor _, task := range res.Items {\n\t\t\tif terminalState(task.Status.State) {\n\t\t\t\tterminalStatesReached++\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif terminalStatesReached == len(res.Items) {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn nil\n}\n","sourceCodeStart":161,"sourceCodeEnd":195,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/command/stack/remove.go#L161-L195","documentation":"Error \"failed to get tasks: %w\" thrown in docker/cli.","triggerScenarios":"Thrown at cli/command/stack/remove.go:179 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}