nats-io/nats-server · error

error setting up list request handling: %v

Error message

error setting up list request handling: %v

What it means

Returned by DirAccResolver setup when the system subscription that answers account-list requests (accListReqSubj) with all account IDs cannot be established. It wraps the sysSubscribe error so the resolver aborts initialization.

Source

Thrown at server/accounts.go:4612

			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)
			s.sendInternalMsgLocked(reply, _EMPTY_, nil, []byte{})
		}
	}); err != nil {
		return fmt.Errorf("error setting up pack request handling: %v", err)
	}
	// respond to list requests with one message containing all account ids
	if _, err := s.sysSubscribe(accListReqSubj, func(_ *subscription, _ *client, _ *Account, _, reply string, _ []byte) {
		handleListRequest(dr.DirJWTStore, s, reply)
	}); err != nil {
		return fmt.Errorf("error setting up list request handling: %v", err)
	}
	if _, err := s.sysSubscribe(accDeleteReqSubj, func(_ *subscription, c *client, _ *Account, _, reply string, msg []byte) {
		// As this is a raw message, we need to extract payload and only decode claims from it,
		// in case request is sent with headers.
		_, msg = c.msgParts(msg)
		handleDeleteRequest(dr.DirJWTStore, s, msg, reply)
	}); err != nil {
		return fmt.Errorf("error setting up delete request handling: %v", err)
	}
	// embed pack responses into store
	if _, err := s.sysSubscribe(packRespIb, func(_ *subscription, _ *client, _ *Account, _, _ string, msg []byte) {
		hash := dr.DirJWTStore.Hash()
		if len(msg) == 0 { // end of response stream
			s.Debugf("DirResolver - Merging finished and resulting in: %x", dr.DirJWTStore.Hash())
			return
		} else if err := dr.DirJWTStore.Merge(string(msg)); err != nil {
			s.Errorf("DirResolver - Merging resulted in error: %v", err)
		} else {

View on GitHub (pinned to 3a66a489d2)

Solutions

  1. Ensure the system account is configured and available on the server.
  2. Inspect the wrapped underlying error for the root cause.
  3. Restart the server so eventing initializes before resolver setup.
  4. Verify resolver configuration options are valid.
Defensive patterns

Strategy: validation

Validate before calling

if srv.Opts.SystemAccount == "" {
    return fmt.Errorf("list request handling requires a system account")
}

Try / catch

if err := dr.Start(); err != nil {
    if strings.Contains(err.Error(), "error setting up list request handling") {
        return fmt.Errorf("resolver list subscription failed: %w", err)
    }
    return err
}

Prevention

When it happens

Trigger: Start()/setup on a DirAccResolver where sysSubscribe(accListReqSubj, ...) fails — eventing not initialized, system account missing, or internal client unavailable.

Common situations: Clustered deployments where the system account is not propagated; resolver started during shutdown; missing system_account directive.

Related errors


AI-assisted analysis of nats-io/nats-server@3a66a489d2 (2026-09-02). Data as JSON: /api/errors/65f640219e5bd177. Report an issue: GitHub.