{"record":{"id":"7fae76f18d28cf6a","repo":"juanfont/headscale","slug":"loading-configuration-w","errorCode":null,"errorMessage":"loading configuration: %w","messagePattern":"loading configuration: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/headscale/cli/oauth_client.go","lineNumber":180,"sourceCode":"\t\t}\n\n\t\terr = v2Error(resp.HTTPResponse.StatusCode, resp.Body)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn printOutput(cmd, map[string]string{\"id\": id}, \"OAuth client \"+id+\" deleted\")\n\t},\n}\n\n// newV2Client builds a generated v2 API client, selecting the transport the same\n// way the v1 client does: over the local unix socket it is unauthenticated\n// (local trust); a remote address injects the configured API key as a bearer\n// token.\nfunc newV2Client() (context.Context, *clientv2.ClientWithResponses, context.CancelFunc, error) {\n\tcfg, err := types.LoadCLIConfig()\n\tif err != nil {\n\t\treturn nil, nil, nil, fmt.Errorf(\"loading configuration: %w\", err)\n\t}\n\n\tctx, cancel := context.WithTimeout(context.Background(), cfg.CLI.Timeout)\n\n\tif cfg.CLI.Address == \"\" {\n\t\tsocketPath := cfg.UnixSocket\n\n\t\thttpClient := &http.Client{Transport: &http.Transport{\n\t\t\tDialContext: func(ctx context.Context, _, _ string) (net.Conn, error) {\n\t\t\t\treturn dialHeadscaleSocket(ctx, socketPath)\n\t\t\t},\n\t\t}}\n\n\t\tclient, err := clientv2.NewClientWithResponses(\"http://local\", clientv2.WithHTTPClient(httpClient))\n\t\tif err != nil {\n\t\t\tcancel()\n\n\t\t\treturn nil, nil, nil, err","sourceCodeStart":162,"sourceCodeEnd":198,"githubUrl":"https://github.com/juanfont/headscale/blob/565fd254d06c4c7f9a8cad1714a43445c79ba420/cmd/headscale/cli/oauth_client.go#L162-L198","documentation":"Error \"loading configuration: %w\" thrown in juanfont/headscale.","triggerScenarios":"Thrown at cmd/headscale/cli/oauth_client.go:180 when the library encounters an invalid state.","commonSituations":"The headscale configuration file could not be loaded. Check the config path (-c flag or default locations) and that the YAML is valid.","solutions":["Inspect the wrapped error for the underlying cause and correct the failing condition (loading configuration); retry the operation after fixing the input, configuration, or environment."],"exampleFix":"Inspect the wrapped error for the underlying cause and correct the failing condition (loading configuration); retry the operation after fixing the input, configuration, or environment.","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"565fd254d06c4c7f9a8cad1714a43445c79ba420","analyzedAt":"2026-08-15T13:12:30.133Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}