{"record":{"id":"34497ebdabceab33","repo":"slackhq/nebula","slug":"could-not-find-hostinfo","errorCode":null,"errorMessage":"could not find hostinfo","messagePattern":"could not find hostinfo","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"ssh.go","lineNumber":942,"sourceCode":"\n\ttype CmdOutput struct {\n\t\tRelays []*RelayOutput\n\t}\n\n\tco := CmdOutput{}\n\n\tenc := json.NewEncoder(w.GetWriter())\n\n\tif args.Pretty {\n\t\tenc.SetIndent(\"\", \"    \")\n\t}\n\n\tfor k, v := range relays {\n\t\tro := RelayOutput{NebulaAddr: v.vpnAddrs[0]}\n\t\tco.Relays = append(co.Relays, &ro)\n\t\trelayHI := ifce.hostMap.QueryVpnAddr(v.vpnAddrs[0])\n\t\tif relayHI == nil {\n\t\t\tro.RelayForAddrs = append(ro.RelayForAddrs, RelayFor{Error: errors.New(\"could not find hostinfo\")})\n\t\t\tcontinue\n\t\t}\n\t\tfor _, vpnAddr := range relayHI.relayState.CopyRelayForIps() {\n\t\t\trf := RelayFor{Error: nil}\n\t\t\tr, ok := relayHI.relayState.GetRelayForByAddr(vpnAddr)\n\t\t\tif ok {\n\t\t\t\tt := \"\"\n\t\t\t\tswitch r.Type {\n\t\t\t\tcase ForwardingType:\n\t\t\t\t\tt = \"forwarding\"\n\t\t\t\tcase TerminalType:\n\t\t\t\t\tt = \"terminal\"\n\t\t\t\tdefault:\n\t\t\t\t\tt = \"unknown\"\n\t\t\t\t}\n\n\t\t\t\ts := \"\"\n\t\t\t\tswitch r.State {","sourceCodeStart":924,"sourceCodeEnd":960,"githubUrl":"https://github.com/slackhq/nebula/blob/dd8f660c0ac37903ec4080ca4d3c861ba9342ceb/ssh.go#L924-L960","documentation":"In nebula's SSH debug/admin interface, sshPrintRelays iterates known relays and looks up each relay's hostinfo via hostMap.QueryVpnAddr. When no hostmap entry exists for a relay's VPN address, the relay entry is still listed but annotated with RelayFor{Error: \"could not find hostinfo\"} instead of its relayed IPs. This is a diagnostics-layer sentinel, not a fatal error: the relay is known but its hostinfo state is absent.","triggerScenarios":"Running `nebula -musage`/ssh command that prints relays when hostMap.QueryVpnAddr(v.vpnAddrs[0]) returns nil — i.e., a relay is recorded in the relays map but its HostInfo was evicted, not yet learned, or the node restarted with stale relay state.","commonSituations":"Inspecting relay state on a lighthouse or relay node shortly after startup; a relay peer that went away and whose hostmap entry expired while relay bookkeeping remains; querying during handshake so the relay's hostinfo is not yet populated.","solutions":["Re-run the relay listing after the relay handshake completes so the hostmap entry exists","Verify network connectivity to the relay peer and that its hostmap entry is not expired (check `nebula -mhostmaps`)","Restart nebula on the affected node to clear stale relay bookkeeping","Treat the error field as informational: filter relays whose RelayForAddrs contain this error rather than crashing"],"exampleFix":"// before\nrelayHI := ifce.hostMap.QueryVpnAddr(v.vpnAddrs[0])\nif relayHI == nil {\n    ro.RelayForAddrs = append(ro.RelayForAddrs, RelayFor{Error: errors.New(\"could not find hostinfo\")})\n    continue\n}\n// after (client-side guard)\nrelayHI := ifce.hostMap.QueryVpnAddr(v.vpnAddrs[0])\nif relayHI == nil {\n    l.WithField(\"vpnAddr\", v.vpnAddrs[0]).Info(\"skipping relay with no hostinfo yet\")\n    continue\n}","handlingStrategy":"validation","validationCode":"relayHI := ifce.hostMap.QueryVpnAddr(relay.vpnAddrs[0])\nif relayHI == nil {\n    // skip or log; do not build RelayFor from nil hostinfo\n    return nil\n}","typeGuard":"func hasHostInfo(h *HostInfo) bool { return h != nil }","tryCatchPattern":"if relayHI == nil {\n    ro.RelayForAddrs = append(ro.RelayForAddrs, RelayFor{Error: errors.New(\"could not find hostinfo\")})\n    continue\n}","preventionTips":["Query the hostmap only after relays have completed handshakes","Monitor hostmap eviction vs relay registration timing","Treat relay listing output as advisory, not authoritative","Re-run the query if the node recently restarted"],"tags":["nebula","hostmap","relay","vpn","diagnostics"],"backgroundTag":"hostinfo-not-found","analyzedSha":"dd8f660c0ac37903ec4080ca4d3c861ba9342ceb","analyzedAt":"2026-09-03T11:13:55.444Z","contentChangedAt":"2026-09-03T11:13:55.444Z","schemaVersion":2},"datasetVersion":"2026-09-10T17:17:09.494Z"}