nats-io/nats-server · error
error setting up lookup request handling: %v
Error message
error setting up lookup request handling: %v
What it means
The dir resolver also subscribes to the account lookup request subject ($SYS.REQ.ACCOUNT...) to serve stored JWTs. If that sysSubscribe fails, setup aborts with 'error setting up lookup request handling: %v', meaning account JWT lookups would be unavailable.
Source
Thrown at server/accounts.go:4584
}
tk := strings.Split(subj, tsep)
if len(tk) != accLookupReqTokens {
return
}
accName := tk[accReqAccIndex]
if theJWT, err := dr.DirJWTStore.LoadAcc(accName); err != nil {
if errors.Is(err, fs.ErrNotExist) {
s.Debugf("DirResolver - Could not find account %q", accName)
// Reply with empty response to signal absence of JWT to others.
s.sendInternalMsgLocked(reply, _EMPTY_, nil, nil)
} else {
s.Errorf("DirResolver - Error looking up account %q: %v", accName, err)
}
} else {
s.sendInternalMsgLocked(reply, _EMPTY_, nil, []byte(theJWT))
}
}); err != nil {
return fmt.Errorf("error setting up lookup request handling: %v", err)
}
// respond to pack requests with one or more pack messages
// an empty message signifies the end of the response responder.
if _, err := s.sysSubscribeQ(accPackReqSubj, "responder", func(_ *subscription, _ *client, _ *Account, _, reply string, theirHash []byte) {
if reply == _EMPTY_ {
return
}
ourHash := dr.DirJWTStore.Hash()
if bytes.Equal(theirHash, ourHash[:]) {
s.sendInternalMsgLocked(reply, _EMPTY_, nil, []byte{})
s.Debugf("DirResolver - Pack request matches hash %x", ourHash[:])
} else if err := dr.DirJWTStore.PackWalk(1, func(partialPackMsg string) {
s.sendInternalMsgLocked(reply, _EMPTY_, nil, []byte(partialPackMsg))
}); err != nil {
// let them timeout
s.Errorf("DirResolver - Pack request error: %v", err)
} else {
s.Debugf("DirResolver - Pack request hash %x - finished responding with hash %x", theirHash, ourHash)View on GitHub (pinned to 3a66a489d2)
Solutions
- Examine the wrapped %v cause and startup logs; fix the underlying subscribe failure.
- Raise subscription limits / free resources and restart the server.
- Verify the system account and internal subject configuration are intact.
Defensive patterns
Strategy: try-catch
Try / catch
if err := startDirResolver(); err != nil && strings.Contains(err.Error(), "error setting up lookup request handling") {
log.WithError(err).Error("account lookup sub failed; account JWT lookups unavailable")
} Prevention
- Confirm resolver startup completed successfully before serving traffic
- Alert on 'error setting up' startup log lines
- Keep system account and internal subjects configured correctly
When it happens
Trigger: Server start/reload where the sysSubscribe for the lookup-request subject errors — internal subscription failure such as limits exhausted or the server shutting down.
Common situations: Same internal-subscription failures as the update-handling errors; seen in startup logs of dir-resolver-enabled servers under resource pressure.
Related errors
- error setting up update handling: %v
- account jwt not found
- subject has exceeded number of tokens limit
- no operator key found
- auth callout violation: auth callout response is not for exp
AI-assisted analysis of nats-io/nats-server@3a66a489d2 (2026-09-02).
Data as JSON: /api/errors/6534993df2722e43.
Report an issue: GitHub.