{"record":{"id":"97893172fce1faff","repo":"netbirdio/netbird","slug":"failed-to-create-request-access-token-v","errorCode":null,"errorMessage":"failed to create request access token: %v","messagePattern":"failed to create request access token: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/internal/auth/device_flow.go","lineNumber":215,"sourceCode":"\t\treturn uri\n\t}\n\n\tquery := parsedURL.Query()\n\tquery.Set(\"login_hint\", loginHint)\n\tparsedURL.RawQuery = query.Encode()\n\n\treturn parsedURL.String()\n}\n\nfunc (d *DeviceAuthorizationFlow) requestToken(info AuthFlowInfo) (TokenRequestResponse, error) {\n\tform := url.Values{}\n\tform.Add(\"client_id\", d.providerConfig.ClientID)\n\tform.Add(\"grant_type\", HostedGrantType)\n\tform.Add(\"device_code\", info.DeviceCode)\n\n\treq, err := http.NewRequest(\"POST\", d.providerConfig.TokenEndpoint, strings.NewReader(form.Encode()))\n\tif err != nil {\n\t\treturn TokenRequestResponse{}, fmt.Errorf(\"failed to create request access token: %v\", err)\n\t}\n\treq.Header.Add(\"Content-Type\", \"application/x-www-form-urlencoded\")\n\n\tres, err := d.HTTPClient.Do(req)\n\tif err != nil {\n\t\treturn TokenRequestResponse{}, fmt.Errorf(\"failed to request access token with error: %v\", err)\n\t}\n\n\tdefer func() {\n\t\terr := res.Body.Close()\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t}()\n\n\tbody, err := io.ReadAll(res.Body)\n\tif err != nil {\n\t\treturn TokenRequestResponse{}, fmt.Errorf(\"failed reading access token response body with error: %v\", err)","sourceCodeStart":197,"sourceCodeEnd":233,"githubUrl":"https://github.com/netbirdio/netbird/blob/93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c/client/internal/auth/device_flow.go#L197-L233","documentation":"Fires in requestToken (called by WaitToken) when http.NewRequest cannot construct the POST to the token endpoint. Since the method, URL, and body are all locally derived, this practically means the configured TokenEndpoint URL failed to parse (e.g. malformed or empty providerConfig.TokenEndpoint), not a network problem.","triggerScenarios":"Thrown at client/internal/auth/device_flow.go:215 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Validate the TokenEndpoint URL in the provider configuration — it must be an absolute, parseable https:// URL","Check the wrapped error: url.Parse failures name the offending URL","Fix the configuration source (defaults, flags, or config file) supplying the endpoint rather than retrying, since a parse error is deterministic"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"93e97f4bf1ad715072dcb3fb6cdb1763431b5a9c","analyzedAt":"2026-08-16T03:09:19.136Z","contentChangedAt":"2026-08-16T03:09:19.136Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}