{"record":{"id":"a33a1c391db28b31","repo":"juanfont/headscale","slug":"collecting-relay-target-ips-w","errorCode":null,"errorMessage":"collecting relay target IPs: %w","messagePattern":"collecting relay target IPs: %w","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"hscontrol/policy/v2/policy.go","lineNumber":243,"sourceCode":"\t\tlog.Warn().Err(testErr).Msg(\"policy sshTests failed at boot; server starting anyway, fix the policy and reload\")\n\t}\n\n\treturn &pm, nil\n}\n\n// updateLocked updates the filter rules based on the current policy and nodes.\n// It must be called with the lock held.\nfunc (pm *PolicyManager) updateLocked() (bool, error) {\n\t// Compile all grants once. Both global and per-node filter\n\t// rules are derived from these compiled grants.\n\tpm.compiledGrants = pm.pol.compileGrants(pm.users, pm.nodes)\n\tpm.userNodeIdx = buildUserNodeIndex(pm.nodes)\n\tpm.needsPerNodeFilter = hasPerNodeGrants(pm.compiledGrants)\n\tpm.viaTargetTags = collectViaTargetTags(pm.compiledGrants)\n\n\trelayTargetIPs, err := collectRelayTargetIPs(pm.compiledGrants)\n\tif err != nil {\n\t\treturn false, fmt.Errorf(\"collecting relay target IPs: %w\", err)\n\t}\n\n\tpm.relayTargetIPs = relayTargetIPs\n\n\tvar filter []tailcfg.FilterRule\n\tif pm.pol == nil || (pm.pol.ACLs == nil && pm.pol.Grants == nil) {\n\t\tfilter = tailcfg.FilterAllowAll\n\t} else {\n\t\tfilter = globalFilterRules(pm.compiledGrants)\n\t}\n\n\t// Hash both the compiled filter AND the policy content together.\n\t// This ensures filterHash changes when policy changes, even for autogroup:self\n\t// where the compiled filter is always empty. This eliminates the need for\n\t// a separate policyHash field.\n\tfilterHash := deephash.Hash(&filterAndPolicy{\n\t\tFilter: filter,\n\t\tPolicy: pm.pol,","sourceCodeStart":225,"sourceCodeEnd":261,"githubUrl":"https://github.com/juanfont/headscale/blob/565fd254d06c4c7f9a8cad1714a43445c79ba420/hscontrol/policy/v2/policy.go#L225-L261","documentation":"Error \"collecting relay target IPs: %w\" thrown in juanfont/headscale.","triggerScenarios":"Thrown at hscontrol/policy/v2/policy.go:243 when the library encounters an invalid state.","commonSituations":"Resolving relay target IPs from the policy failed. Check the policy's relay/destination entries are valid aliases, hosts, or prefixes.","solutions":["Inspect the wrapped error for the underlying cause and correct the failing condition (collecting relay target IPs); retry the operation after fixing the input, configuration, or environment."],"exampleFix":"Inspect the wrapped error for the underlying cause and correct the failing condition (collecting relay target IPs); retry the operation after fixing the input, configuration, or environment.","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"565fd254d06c4c7f9a8cad1714a43445c79ba420","analyzedAt":"2026-08-15T13:12:30.133Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}