{"id":"1b5b23256780fc40","repo":"docker/cli","slug":"unable-to-resolve-docker-endpoint-w","errorCode":null,"errorMessage":"unable to resolve docker endpoint: %w","messagePattern":"unable to resolve docker endpoint: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/command/cli.go","lineNumber":298,"sourceCode":"\treturn nil\n}\n\n// NewAPIClientFromFlags creates a new APIClient from command line flags\nfunc NewAPIClientFromFlags(opts *cliflags.ClientOptions, configFile *configfile.ConfigFile) (client.APIClient, error) {\n\tif opts.Context != \"\" && len(opts.Hosts) > 0 {\n\t\treturn nil, errors.New(\"conflicting options: cannot specify both --host and --context\")\n\t}\n\n\tstoreConfig := DefaultContextStoreConfig()\n\tcontextStore := &ContextStoreWithDefault{\n\t\tStore: store.New(config.ContextStoreDir(), storeConfig),\n\t\tResolver: func() (*DefaultContext, error) {\n\t\t\treturn resolveDefaultContext(opts, storeConfig)\n\t\t},\n\t}\n\tendpoint, err := resolveDockerEndpoint(contextStore, resolveContextName(opts, configFile))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to resolve docker endpoint: %w\", err)\n\t}\n\treturn newAPIClientFromEndpoint(endpoint, configFile, client.WithUserAgent(UserAgent()))\n}\n\nfunc newAPIClientFromEndpoint(ep docker.Endpoint, configFile *configfile.ConfigFile, extraOpts ...client.Opt) (client.APIClient, error) {\n\topts, err := ep.ClientOpts()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(configFile.HTTPHeaders) > 0 {\n\t\topts = append(opts, client.WithHTTPHeaders(configFile.HTTPHeaders))\n\t}\n\twithCustomHeaders, err := withCustomHeadersFromEnv()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif withCustomHeaders != nil {\n\t\topts = append(opts, withCustomHeaders)","sourceCodeStart":280,"sourceCodeEnd":316,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/command/cli.go#L280-L316","documentation":"Error \"unable to resolve docker endpoint: %w\" thrown in docker/cli.","triggerScenarios":"Thrown at cli/command/cli.go:298 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}