{"id":"e109971dda19d9df","repo":"docker/cli","slug":"failed-to-create-service-s-w","errorCode":null,"errorMessage":"failed to create service %s: %w","messagePattern":"failed to create service (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/command/stack/deploy_composefile.go","lineNumber":294,"sourceCode":"\n\t\t\tfor _, warning := range response.Warnings {\n\t\t\t\t_, _ = fmt.Fprintln(dockerCLI.Err(), warning)\n\t\t\t}\n\n\t\t\tserviceIDs = append(serviceIDs, svc.ID)\n\t\t} else {\n\t\t\t_, _ = fmt.Fprintln(out, \"Creating service\", name)\n\n\t\t\t// query registry if flag disabling it was not set\n\t\t\tqueryRegistry := resolveImage == resolveImageAlways || resolveImage == resolveImageChanged\n\n\t\t\tresponse, err := apiClient.ServiceCreate(ctx, client.ServiceCreateOptions{\n\t\t\t\tSpec:                serviceSpec,\n\t\t\t\tEncodedRegistryAuth: encodedAuth,\n\t\t\t\tQueryRegistry:       queryRegistry,\n\t\t\t})\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"failed to create service %s: %w\", name, err)\n\t\t\t}\n\n\t\t\tserviceIDs = append(serviceIDs, response.ID)\n\t\t}\n\t}\n\n\treturn serviceIDs, nil\n}\n\nfunc waitOnServices(ctx context.Context, dockerCli command.Cli, serviceIDs []string, quiet bool) error {\n\tvar errs []error\n\tfor _, serviceID := range serviceIDs {\n\t\tif err := service.WaitOnService(ctx, dockerCli, serviceID, quiet); err != nil {\n\t\t\terrs = append(errs, fmt.Errorf(\"%s: %w\", serviceID, err))\n\t\t}\n\t}\n\treturn errors.Join(errs...)\n}","sourceCodeStart":276,"sourceCodeEnd":312,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/command/stack/deploy_composefile.go#L276-L312","documentation":"Error \"failed to create service %s: %w\" thrown in docker/cli.","triggerScenarios":"Thrown at cli/command/stack/deploy_composefile.go:294 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}