{"record":{"id":"215ebf192659f70a","repo":"hashicorp/nomad","slug":"no-servers-found","errorCode":null,"errorMessage":"No servers found","messagePattern":"No servers found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"nomad/autopilot.go","lineNumber":187,"sourceCode":"\nfunc stringIDs(ids []raft.ServerID) []string {\n\treturn helper.ConvertSlice(ids, func(id raft.ServerID) string { return string(id) })\n}\n\nfunc minRaftProtocol(members []*peers.Parts) (int, error) {\n\tminVersion := -1\n\tfor _, m := range members {\n\t\tif m.Status != serf.StatusAlive {\n\t\t\tcontinue\n\t\t}\n\n\t\tif minVersion == -1 || m.RaftVersion < minVersion {\n\t\t\tminVersion = m.RaftVersion\n\t\t}\n\t}\n\n\tif minVersion == -1 {\n\t\treturn minVersion, fmt.Errorf(\"No servers found\")\n\t}\n\n\treturn minVersion, nil\n}\n\nfunc (s *Server) autopilotServers() map[raft.ServerID]*autopilot.Server {\n\n\t// Get a list of the regional peers for our local region. We cannot use the\n\t// LocalPeers function, as we need peers in all states.\n\tlocalPeers := s.peersCache.RegionPeers(s.Region())\n\n\tservers := make(map[raft.ServerID]*autopilot.Server, len(localPeers))\n\n\tfor _, srv := range localPeers {\n\t\tautopilotServer := s.autopilotServerFromMetadata(srv)\n\t\tservers[autopilotServer.ID] = autopilotServer\n\t}\n","sourceCodeStart":169,"sourceCodeEnd":205,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/autopilot.go#L169-L205","documentation":"minRaftProtocol computes the minimum Raft protocol version across all autopilot-tracked servers. It initializes minVersion to -1 and returns this error when the server set is empty, meaning it could not determine any protocol version. Callers use this to gate Raft-protocol-dependent features.","triggerScenarios":"Calling MinRaftProtocol (via minRaftProtocol) when autopilotServers() returns an empty map — e.g. no servers are registered with autopilot yet, or the local server has no peer information.","commonSituations":"Querying raft protocol requirements during server startup before the LAN Serf membership is populated; running against a single-node setup with autopilot state not yet initialized; tests without a bootstrapped peer set.","solutions":["Retry after the server has fully joined the LAN pool and autopilot has enumerated peers.","Check server logs / `nomad server members` to confirm servers are actually members.","In tests, bootstrap the raft/serf state before calling MinRaftProtocol."],"exampleFix":"// before\nmin, err := srv.MinRaftProtocol(false) // may return \"No servers found\" at startup\n// after\nmin, err := srv.MinRaftProtocol(false)\nif err != nil && err.Error() == \"No servers found\" {\n    time.Sleep(time.Second)\n    min, err = srv.MinRaftProtocol(false)\n}","handlingStrategy":"retry","validationCode":"members, err := client.Agent().Members()\nif err != nil || len(members.Members) == 0 {\n    return fmt.Errorf(\"no server members yet; defer MinRaftProtocol call\")\n}","typeGuard":null,"tryCatchPattern":"min, err := srv.MinRaftProtocol(false)\nfor err != nil && strings.Contains(err.Error(), \"No servers found\") {\n    time.Sleep(500 * time.Millisecond)\n    min, err = srv.MinRaftProtocol(false)\n}","preventionTips":["Call MinRaftProtocol only after the server has joined the LAN pool.","Confirm server membership via `nomad server members` first.","In tests, bootstrap serf/raft state before probing protocol versions."],"tags":["nomad","raft","autopilot","consensus"],"backgroundTag":"no-servers-available","analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}