{"record":{"id":"b746f12ec0b6628d","repo":"juanfont/headscale","slug":"updating-policy-manager-after-setting-expiry-w","errorCode":null,"errorMessage":"updating policy manager after setting expiry: %w","messagePattern":"updating policy manager after setting expiry: %w","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"hscontrol/state/state.go","lineNumber":924,"sourceCode":"\t// sent to the batcher, preventing inconsistent state propagation.\n\tn, ok := s.nodeStore.UpdateNode(nodeID, func(node *types.Node) {\n\t\tnode.Expiry = expiry\n\t})\n\n\tif !ok {\n\t\treturn types.NodeView{}, change.Change{}, fmt.Errorf(\"%w: %d\", ErrNodeNotInNodeStore, nodeID)\n\t}\n\n\t// Persist expiry change to database directly since persistNodeToDB omits expiry.\n\terr := s.db.NodeSetExpiry(nodeID, expiry)\n\tif err != nil {\n\t\treturn types.NodeView{}, change.Change{}, fmt.Errorf(\"setting node expiry in database: %w\", err)\n\t}\n\n\t// Update policy manager and generate change notification.\n\tc, err := s.updatePolicyManagerNodes()\n\tif err != nil {\n\t\treturn n, change.Change{}, fmt.Errorf(\"updating policy manager after setting expiry: %w\", err)\n\t}\n\n\tif c.IsEmpty() {\n\t\tc = change.NodeAdded(n.ID())\n\t}\n\n\treturn n, c, nil\n}\n\n// SetNodeTags assigns tags to a node, making it a \"tagged node\".\n// Once a node is tagged, it cannot be un-tagged (only tags can be changed).\n// Setting tags clears UserID since tagged nodes are owned by their tags.\nfunc (s *State) SetNodeTags(nodeID types.NodeID, tags []string) (types.NodeView, change.Change, error) {\n\tif len(tags) == 0 {\n\t\treturn types.NodeView{}, change.Change{}, types.ErrCannotRemoveAllTags\n\t}\n\n\t// Get node for validation","sourceCodeStart":906,"sourceCodeEnd":942,"githubUrl":"https://github.com/juanfont/headscale/blob/565fd254d06c4c7f9a8cad1714a43445c79ba420/hscontrol/state/state.go#L906-L942","documentation":"Error \"updating policy manager after setting expiry: %w\" thrown in juanfont/headscale.","triggerScenarios":"Thrown at hscontrol/state/state.go:924 when the library encounters an invalid state.","commonSituations":"Refreshing the policy manager after an expiry change failed. Check server logs for the policy evaluation error.","solutions":["Inspect the wrapped error for the underlying cause and correct the failing condition (updating policy manager after setting expiry); retry the operation after fixing the input, configuration, or environment."],"exampleFix":"Inspect the wrapped error for the underlying cause and correct the failing condition (updating policy manager after setting expiry); 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-15T17:31:12.345Z"}