{"record":{"id":"6534993df2722e43","repo":"nats-io/nats-server","slug":"error-setting-up-lookup-request-handling-v","errorCode":null,"errorMessage":"error setting up lookup request handling: %v","messagePattern":"error setting up lookup request handling: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/accounts.go","lineNumber":4584,"sourceCode":"\t\t}\n\t\ttk := strings.Split(subj, tsep)\n\t\tif len(tk) != accLookupReqTokens {\n\t\t\treturn\n\t\t}\n\t\taccName := tk[accReqAccIndex]\n\t\tif theJWT, err := dr.DirJWTStore.LoadAcc(accName); err != nil {\n\t\t\tif errors.Is(err, fs.ErrNotExist) {\n\t\t\t\ts.Debugf(\"DirResolver - Could not find account %q\", accName)\n\t\t\t\t// Reply with empty response to signal absence of JWT to others.\n\t\t\t\ts.sendInternalMsgLocked(reply, _EMPTY_, nil, nil)\n\t\t\t} else {\n\t\t\t\ts.Errorf(\"DirResolver - Error looking up account %q: %v\", accName, err)\n\t\t\t}\n\t\t} else {\n\t\t\ts.sendInternalMsgLocked(reply, _EMPTY_, nil, []byte(theJWT))\n\t\t}\n\t}); err != nil {\n\t\treturn fmt.Errorf(\"error setting up lookup request handling: %v\", err)\n\t}\n\t// respond to pack requests with one or more pack messages\n\t// an empty message signifies the end of the response responder.\n\tif _, err := s.sysSubscribeQ(accPackReqSubj, \"responder\", func(_ *subscription, _ *client, _ *Account, _, reply string, theirHash []byte) {\n\t\tif reply == _EMPTY_ {\n\t\t\treturn\n\t\t}\n\t\tourHash := dr.DirJWTStore.Hash()\n\t\tif bytes.Equal(theirHash, ourHash[:]) {\n\t\t\ts.sendInternalMsgLocked(reply, _EMPTY_, nil, []byte{})\n\t\t\ts.Debugf(\"DirResolver - Pack request matches hash %x\", ourHash[:])\n\t\t} else if err := dr.DirJWTStore.PackWalk(1, func(partialPackMsg string) {\n\t\t\ts.sendInternalMsgLocked(reply, _EMPTY_, nil, []byte(partialPackMsg))\n\t\t}); err != nil {\n\t\t\t// let them timeout\n\t\t\ts.Errorf(\"DirResolver - Pack request error: %v\", err)\n\t\t} else {\n\t\t\ts.Debugf(\"DirResolver - Pack request hash %x - finished responding with hash %x\", theirHash, ourHash)","sourceCodeStart":4566,"sourceCodeEnd":4602,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/accounts.go#L4566-L4602","documentation":"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.","triggerScenarios":"Server start/reload where the sysSubscribe for the lookup-request subject errors — internal subscription failure such as limits exhausted or the server shutting down.","commonSituations":"Same internal-subscription failures as the update-handling errors; seen in startup logs of dir-resolver-enabled servers under resource pressure.","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."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := startDirResolver(); err != nil && strings.Contains(err.Error(), \"error setting up lookup request handling\") {\n    log.WithError(err).Error(\"account lookup sub failed; account JWT lookups unavailable\")\n}","preventionTips":["Confirm resolver startup completed successfully before serving traffic","Alert on 'error setting up' startup log lines","Keep system account and internal subjects configured correctly"],"tags":["nats","resolver","subscription","lookup"],"backgroundTag":"subscription-setup-failed","analyzedSha":"3a66a489d262bf89b71a71c955c94920394532f3","analyzedAt":"2026-09-02T04:41:54.247Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}