{"record":{"id":"b106ed0f933ce8c3","repo":"juanfont/headscale","slug":"auto-approving-nodes-w","errorCode":null,"errorMessage":"auto approving nodes: %w","messagePattern":"auto approving nodes: %w","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"hscontrol/state/state.go","lineNumber":369,"sourceCode":"\t// Per-node selective self refresh for nodeAttrs. A broadcast\n\t// [change.PolicyChange] re-renders peer lists and packet filters\n\t// but never repopulates a node's own [tailcfg.Node.CapMap]; that\n\t// lives on the self entry only. The drain returns every node ID\n\t// whose cap output shifted across recent updateLocked calls —\n\t// refreshNodeAttrsLocked appends rather than overwrites so a\n\t// concurrent SetUsers/SetNodes between SetPolicy and the drain\n\t// cannot silently lose the policy-reload diff.\n\tfor _, id := range s.polMan.NodesWithChangedCapMap() {\n\t\tcs = append(cs, change.SelfUpdate(id))\n\t}\n\n\t// Always call autoApproveNodes during policy reload, regardless of whether\n\t// the policy content has changed. This ensures that routes are re-evaluated\n\t// when they might have been manually disabled but could now be auto-approved\n\t// with the current policy.\n\trcs, err := s.autoApproveNodes()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"auto approving nodes: %w\", err)\n\t}\n\n\t// TODO(kradalby): These changes can probably be safely ignored.\n\t// If the PolicyChange is happening, that will lead to a full update\n\t// meaning that we do not need to send individual route changes.\n\tcs = append(cs, rcs...)\n\n\tif len(rcs) > 0 || policyChanged {\n\t\tlog.Info().\n\t\t\tBool(\"policy.changed\", policyChanged).\n\t\t\tInt(\"route.changes\", len(rcs)).\n\t\t\tInt(\"total.changes\", len(cs)).\n\t\t\tMsg(\"Policy reload completed with changes\")\n\t}\n\n\treturn cs, nil\n}\n","sourceCodeStart":351,"sourceCodeEnd":387,"githubUrl":"https://github.com/juanfont/headscale/blob/565fd254d06c4c7f9a8cad1714a43445c79ba420/hscontrol/state/state.go#L351-L387","documentation":"Error \"auto approving nodes: %w\" thrown in juanfont/headscale.","triggerScenarios":"Thrown at hscontrol/state/state.go:369 when the library encounters an invalid state.","commonSituations":"Auto-approving routes for nodes failed during a policy update. Check that autoApprovers entries resolve and advertised routes are valid.","solutions":["Inspect the wrapped error for the underlying cause and correct the failing condition (auto approving nodes); retry the operation after fixing the input, configuration, or environment."],"exampleFix":"Inspect the wrapped error for the underlying cause and correct the failing condition (auto approving nodes); 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"}