{"record":{"id":"b8e9f5b9089a8bd6","repo":"larksuite/cli","slug":"failed-to-get-http-client-for-user-info-w","errorCode":null,"errorMessage":"failed to get HTTP client for user_info: %w","messagePattern":"failed to get HTTP client for user_info: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/credential/credential_provider.go","lineNumber":243,"sourceCode":"func (p *CredentialProvider) enrichUserInfo(ctx context.Context, acct *Account, source credentialSource) error {\n\tif p.httpClient == nil || source == nil {\n\t\treturn nil\n\t}\n\ttok, found, err := source.TryResolveToken(ctx, TokenSpec{Type: TokenTypeUAT, AppID: acct.AppID})\n\tif err != nil {\n\t\tvar blockErr *extcred.BlockError\n\t\tif errors.As(err, &blockErr) {\n\t\t\treturn nil // provider explicitly blocks UAT; skip enrichment\n\t\t}\n\t\treturn fmt.Errorf(\"failed to resolve UAT for user identity verification: %w\", err)\n\t}\n\tif !found {\n\t\treturn nil\n\t}\n\t// Have UAT — must verify and resolve identity\n\thc, err := p.httpClient()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get HTTP client for user_info: %w\", err)\n\t}\n\trequestCtx := core.WithCredentialSource(ctx, tok.Source)\n\tinfo, err := fetchUserInfo(requestCtx, hc, acct.Brand, tok.Token)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to verify user identity: %w\", err)\n\t}\n\tacct.UserOpenId = info.OpenID\n\tacct.UserName = info.Name\n\treturn nil\n}\n\nfunc (p *CredentialProvider) selectedCredentialSource(ctx context.Context) (credentialSource, error) {\n\tif p.selectedSource != nil {\n\t\treturn p.selectedSource, nil\n\t}\n\tif p.defaultAcct == nil {\n\t\treturn nil, nil\n\t}","sourceCodeStart":225,"sourceCodeEnd":261,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/internal/credential/credential_provider.go#L225-L261","documentation":"After a UAT is successfully resolved, the provider must verify the user's identity with an HTTP call to the user_info endpoint. Building that HTTP client failed, so identity verification cannot proceed and the error is wrapped and propagated. This is an infrastructure failure (client construction), not a token or API failure.","triggerScenarios":"p.httpClient() returns an error after TryResolveToken reported a UAT found=true — e.g. TLS/proxy/transport configuration cannot be initialized (bad proxy URL, missing CA bundle, invalid transport settings).","commonSituations":"Corporate proxy configured with an invalid URL; custom CA/certificate setup broken; environment (HTTPS_PROXY, SSL cert paths) pointing at unusable values while a UAT-bearing credential source is active.","solutions":["Inspect the wrapped cause from p.httpClient() and fix the HTTP client construction inputs: proxy settings (HTTPS_PROXY/HTTP_PROXY), CA bundle paths, TLS config","Verify network environment variables resolve to valid URLs and that the CA file exists and is readable","Once the transport issue is fixed, re-run the command; no re-auth is needed since the UAT itself resolved fine"],"exampleFix":"// before (env)\nHTTPS_PROXY=\"not a url\"\n// after\nHTTPS_PROXY=\"http://proxy.corp.example:8080\"","handlingStrategy":"validation","validationCode":"// Fail fast on bad proxy/CA env before any API call\nif p := os.Getenv(\"HTTPS_PROXY\"); p != \"\" {\n\tif _, err := url.Parse(p); err != nil {\n\t\treturn fmt.Errorf(\"invalid HTTPS_PROXY %q: %w\", p, err)\n\t}\n}\nif ca := os.Getenv(\"SSL_CERT_FILE\"); ca != \"\" {\n\tif _, err := os.Stat(ca); err != nil {\n\t\treturn fmt.Errorf(\"CA bundle missing: %w\", err)\n\t}\n}","typeGuard":null,"tryCatchPattern":"acct, err := provider.ResolveAccount(ctx)\nif err != nil && strings.Contains(err.Error(), \"failed to get HTTP client for user_info\") {\n\t// transport config problem — inspect and fix proxy/CA settings, then retry\n}","preventionTips":["Validate HTTPS_PROXY/HTTP_PROXY/NO_PROXY values in shell profiles","Keep system CA bundles installed and SSL_CERT_FILE/SSL_CERT_DIR pointing at real files","Test connectivity to the Lark endpoints after changing network configuration"],"tags":["http-client","network","proxy","tls"],"backgroundTag":"http-client-init-failed","analyzedSha":"7fd6ef3c07182257ce776cdc5a614e122d5bd4b3","analyzedAt":"2026-09-04T21:17:44.649Z","contentChangedAt":"2026-09-04T21:17:44.649Z","schemaVersion":2},"datasetVersion":"2026-09-12T02:17:10.037Z"}