{"record":{"id":"defc383af2f67cf1","repo":"juanfont/headscale","slug":"w-d-s","errorCode":null,"errorMessage":"%w: %d %s","messagePattern":"%w: %d %s","errorType":"http","errorClass":"errResponseStatus","httpStatus":null,"severity":"error","filePath":"cmd/headscale/cli/utils.go","lineNumber":50,"sourceCode":"\n\toutputFormatJSON     = \"json\"\n\toutputFormatJSONLine = \"json-line\"\n\toutputFormatYAML     = \"yaml\"\n)\n\nvar (\n\terrAPIKeyNotSet     = errors.New(\"HEADSCALE_CLI_API_KEY environment variable needs to be set\")\n\terrMissingParameter = errors.New(\"missing parameters\")\n\terrResponseStatus   = errors.New(\"unexpected response status\")\n)\n\n// apiError turns a non-2xx response into an error, surfacing the server's\n// RFC7807 problem detail. detail holds the operation context and errors[] the\n// wrapped cause (e.g. \"name is too long\"); both are joined so the server's\n// message text is not lost.\nfunc apiError(statusCode int, problem *clientv1.ErrorModel) error {\n\tif problem == nil {\n\t\treturn fmt.Errorf(\"%w: %d %s\", errResponseStatus, statusCode, http.StatusText(statusCode))\n\t}\n\n\tparts := make([]string, 0, 2)\n\n\tif problem.Detail != nil && *problem.Detail != \"\" {\n\t\tparts = append(parts, *problem.Detail)\n\t}\n\n\tif problem.Errors != nil {\n\t\tfor _, e := range *problem.Errors {\n\t\t\tif e.Message != nil && *e.Message != \"\" {\n\t\t\t\tparts = append(parts, *e.Message)\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(parts) == 0 && problem.Title != nil && *problem.Title != \"\" {\n\t\tparts = append(parts, *problem.Title)","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/juanfont/headscale/blob/565fd254d06c4c7f9a8cad1714a43445c79ba420/cmd/headscale/cli/utils.go#L32-L68","documentation":"Error \"%w: %d %s\" thrown in juanfont/headscale.","triggerScenarios":"Thrown at cmd/headscale/cli/utils.go:50 when the library encounters an invalid state.","commonSituations":"A gRPC status error was returned by the server for the CLI request. Read the embedded code and message for the specific failure and check server logs.","solutions":["Inspect the wrapped error for the underlying cause and correct the failing condition (); retry the operation after fixing the input, configuration, or environment."],"exampleFix":"Inspect the wrapped error for the underlying cause and correct the failing condition (); 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-15T22:17:37.221Z"}