{"record":{"id":"e2f7c3f343c4e0f8","repo":"juanfont/headscale","slug":"loading-configuration-w-e2f7c3","errorCode":null,"errorMessage":"loading configuration: %w","messagePattern":"loading configuration: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/headscale/cli/utils.go","lineNumber":92,"sourceCode":"\n\treturn fmt.Errorf(\"%w: %s\", errResponseStatus, strings.Join(parts, \": \"))\n}\n\n// mustMarkRequired marks the named flags as required, panicking on an unknown\n// flag. Only called from init(), where a failure is a programming error.\nfunc mustMarkRequired(cmd *cobra.Command, names ...string) {\n\tfor _, n := range names {\n\t\terr := cmd.MarkFlagRequired(n)\n\t\tif err != nil {\n\t\t\tpanic(fmt.Sprintf(\"marking flag %q required on %q: %v\", n, cmd.Name(), err))\n\t\t}\n\t}\n}\n\nfunc newHeadscaleServerWithConfig() (*hscontrol.Headscale, error) {\n\tcfg, err := types.LoadServerConfig()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\n\t\t\t\"loading configuration: %w\",\n\t\t\terr,\n\t\t)\n\t}\n\n\tapp, err := hscontrol.NewHeadscale(cfg)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"creating new headscale: %w\", err)\n\t}\n\n\treturn app, nil\n}\n\n// clientRunE wraps a [cobra.Command.RunE] func, injecting a ready API client\n// and a context whose timeout/cancel the wrapper owns.\nfunc clientRunE(\n\tfn func(ctx context.Context, client *clientv1.ClientWithResponses, cmd *cobra.Command, args []string) error,\n) func(*cobra.Command, []string) error {","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/juanfont/headscale/blob/565fd254d06c4c7f9a8cad1714a43445c79ba420/cmd/headscale/cli/utils.go#L74-L110","documentation":"Error \"loading configuration: %w\" thrown in juanfont/headscale.","triggerScenarios":"Thrown at cmd/headscale/cli/utils.go:92 when the library encounters an invalid state.","commonSituations":"The CLI could not load the headscale configuration. Verify the config file path and YAML validity, or set the correct socket/address and API key flags.","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"}