nats-io/nats-server · warning
could not fetch <%q>: no response
Error message
could not fetch <%q>: no response
What it means
URLAccResolver.Fetch treats a nil HTTP response with no error as a fatal anomaly. http.Client.Get normally returns either err or a response; a nil response with nil err is unexpected, so the resolver reports it as 'could not fetch <url>: no response'.
Source
Thrown at server/accounts.go:4251
MaxIdleConns: 10,
IdleConnTimeout: 30 * time.Second,
}
ur := &URLAccResolver{
url: url,
c: &http.Client{Timeout: DEFAULT_ACCOUNT_FETCH_TIMEOUT, Transport: tr},
}
return ur, nil
}
// Fetch will fetch the account jwt claims from the base url, appending the
// account name onto the end.
func (ur *URLAccResolver) Fetch(name string) (string, error) {
url := ur.url + name
resp, err := ur.c.Get(url)
if err != nil {
return _EMPTY_, fmt.Errorf("could not fetch <%q>: %v", redactURLString(url), err)
} else if resp == nil {
return _EMPTY_, fmt.Errorf("could not fetch <%q>: no response", redactURLString(url))
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
return _EMPTY_, fmt.Errorf("could not fetch <%q>: %v", redactURLString(url), resp.Status)
}
body, err := io.ReadAll(resp.Body)
if err != nil {
return _EMPTY_, err
}
return string(body), nil
}
// Resolver based on nats for synchronization and backing directory for storage.
type DirAccResolver struct {
*DirJWTStore
*Server
syncInterval time.Duration
fetchTimeout time.DurationView on GitHub (pinned to 3a66a489d2)
Solutions
- Use the default http.Client or a correctly-behaving transport for the resolver
- Inspect any custom RoundTripper for paths that return nil response and nil error
- Log and restart/reconnect if a transient transport corruption is suspected
Example fix
// before ur, err := NewURLAccResolver(url) // replaced client with custom transport returning nil,nil // after ur, err := NewURLAccResolver(url) // keep default client, or fix RoundTripper to always return non-nil resp with err
Defensive patterns
Strategy: fallback
Try / catch
jwt, err := fetchAccount(resolver, key)
if err != nil && strings.Contains(err.Error(), "no response") {
// replace/recreate the resolver client; use fallback resolver
}
Prevention
- Avoid custom RoundTrippers that can return (nil, nil)
- Keep the default http.Client unless transport behavior is well tested
- Alert on this error: it indicates a broken HTTP client/transport
When it happens
Trigger: Calling Fetch when ur.c.Get returns (nil, nil) — a pathological client/transport state, e.g. a custom HTTP client or RoundTripper misbehaving.
Common situations: Custom HTTP client injected into URLAccResolver (NewURLAccResolver with custom client) whose transport violates the net/http contract; heavily customized/proxied transports.
Related errors
- could not fetch <%q>: %v
- will only fetch valid account keys
- store operation not supported for URL Resolver
- delete must be enabled in server config
- not self signed
AI-assisted analysis of nats-io/nats-server@3a66a489d2 (2026-09-02).
Data as JSON: /api/errors/2f40a8d723eeae19.
Report an issue: GitHub.