{"record":{"id":"d6b7995733ca3577","repo":"nats-io/nats-server","slug":"account-resolver-missing","errorCode":null,"errorMessage":"account resolver missing","messagePattern":"account resolver missing","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/errors.go","lineNumber":129,"sourceCode":"\tErrMissingAccount = errors.New(\"account missing\")\n\n\t// ErrMissingService is returned when an account does not have an exported service.\n\tErrMissingService = errors.New(\"service missing\")\n\n\t// ErrBadServiceType is returned when latency tracking is being applied to non-singleton response types.\n\tErrBadServiceType = errors.New(\"bad service response type\")\n\n\t// ErrBadSampling is returned when the sampling for latency tracking is not 1 >= sample <= 100.\n\tErrBadSampling = errors.New(\"bad sampling percentage, should be 1-100\")\n\n\t// ErrAccountValidation is returned when an account has failed validation.\n\tErrAccountValidation = errors.New(\"account validation failed\")\n\n\t// ErrAccountExpired is returned when an account has expired.\n\tErrAccountExpired = errors.New(\"account expired\")\n\n\t// ErrNoAccountResolver is returned when we attempt an update but do not have an account resolver.\n\tErrNoAccountResolver = errors.New(\"account resolver missing\")\n\n\t// ErrAccountResolverUpdateTooSoon is returned when we attempt an update too soon to last request.\n\tErrAccountResolverUpdateTooSoon = errors.New(\"account resolver update too soon\")\n\n\t// ErrAccountResolverSameClaims is returned when same claims have been fetched.\n\tErrAccountResolverSameClaims = errors.New(\"account resolver no new claims\")\n\n\t// ErrStreamImportAuthorization is returned when a stream import is not authorized.\n\tErrStreamImportAuthorization = errors.New(\"stream import not authorized\")\n\n\t// ErrStreamImportBadPrefix is returned when a stream import prefix contains wildcards.\n\tErrStreamImportBadPrefix = errors.New(\"stream import prefix can not contain wildcard tokens\")\n\n\t// ErrStreamImportDuplicate is returned when a stream import is a duplicate of one that already exists.\n\tErrStreamImportDuplicate = errors.New(\"stream import already exists\")\n\n\t// ErrServiceImportAuthorization is returned when a service import is not authorized.\n\tErrServiceImportAuthorization = errors.New(\"service import not authorized\")","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/nats-io/nats-server/blob/3a66a489d262bf89b71a71c955c94920394532f3/server/errors.go#L111-L147","documentation":"ErrNoAccountResolver is returned when an account update/fetch is attempted but the server has no account resolver configured. fetch() returns it when the server or the resolver is nil, and fetchUpdatedAccount returns it when s.AccountResolver() is nil — meaning there is no mechanism (URL resolver or MemAccResolver) to retrieve account claims.","triggerScenarios":"Calling s.fetch / fetchUpdatedAccount on a server whose AccountResolver() returns nil — e.g. a server started with static account definitions and no resolver configured (no account resolver URL like nats:// or file resolver in the config).","commonSituations":"Deploying a server configured with inline accounts (no resolver) while code paths expect dynamic account claim updates; tests running against servers built without SetAccountResolver; mixing standalone and operator/resolver-based setups; calling Fetch/update APIs on a client-config-only server.","solutions":["Configure an account resolver in the server config (resolver: URL(...) or a memory resolver) before performing dynamic account updates","In code/tests, install a resolver via s.SetAccountResolver(...) before calling fetch/update paths","Skip fetch/update logic when the server is intentionally static (guard with s.AccountResolver() != nil)","Verify the server was started with the operator/resolver-based configuration you intended"],"exampleFix":"// before\njwt, err := s.fetchUpdatedAccount(acc) // no resolver -> ErrNoAccountResolver\n// after\nif s.AccountResolver() == nil {\n\ts.SetAccountResolver(newURLAccResolver(resolverURL))\n}\njwt, err := s.fetchUpdatedAccount(acc)","handlingStrategy":"validation","validationCode":"if s.AccountResolver() == nil { return errors.New(\"account resolver not configured; cannot fetch dynamic account updates\") }","typeGuard":"func hasAccountResolver(s *Server) bool { return s != nil && s.AccountResolver() != nil }","tryCatchPattern":"jwt, err := s.fetchUpdatedAccount(acc)\nif errors.Is(err, ErrNoAccountResolver) { /* fall back to statically configured account or configure a resolver */ }","preventionTips":["Configure a resolver (URL or memory) whenever dynamic account updates are needed","Guard resolver-dependent code paths with AccountResolver() != nil","Align server config mode (static accounts vs operator/resolver) with the APIs you call"],"tags":["nats","server","account-resolver","configuration"],"backgroundTag":"missing-account-resolver","analyzedSha":"3a66a489d262bf89b71a71c955c94920394532f3","analyzedAt":"2026-09-02T04:41:54.247Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}