{"record":{"id":"9569315ad3d67091","repo":"juanfont/headscale","slug":"compiling-nodeattrs-w","errorCode":null,"errorMessage":"compiling nodeAttrs: %w","messagePattern":"compiling nodeAttrs: %w","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"hscontrol/policy/v2/policy.go","lineNumber":1789,"sourceCode":"// SetUsers/SetNodes between SetPolicy and a NodesWithChangedCapMap\n// drain cannot clobber the policy-reload diff.\n//\n// Caller must hold pm.mu.\nfunc (pm *PolicyManager) refreshNodeAttrsLocked() error {\n\t// Fast path for the common steady-state shape: tailnet has no\n\t// nodeAttrs entries and never had any. Skip the compile + per-node\n\t// hash walk entirely. As soon as the operator adds a nodeAttrs\n\t// entry pm.nodeAttrsHashes becomes non-empty and the gate opens.\n\tif pm.pol != nil &&\n\t\tlen(pm.pol.NodeAttrs) == 0 &&\n\t\t!pm.pol.RandomizeClientPort &&\n\t\tlen(pm.nodeAttrsHashes) == 0 {\n\t\treturn nil\n\t}\n\n\tnewMap, err := pm.pol.compileNodeAttrs(pm.users, pm.nodes)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"compiling nodeAttrs: %w\", err)\n\t}\n\n\tnewHashes := make(map[types.NodeID]deephash.Sum, len(newMap))\n\tfor id, capMap := range newMap {\n\t\tnewHashes[id] = deephash.Hash(&capMap)\n\t}\n\n\t// Walk the union of old and new node IDs and emit the delta.\n\tseen := make(map[types.NodeID]struct{}, len(newHashes)+len(pm.nodeAttrsHashes))\n\n\tvar changed []types.NodeID\n\n\tfor id, h := range newHashes {\n\t\tseen[id] = struct{}{}\n\t\tif pm.nodeAttrsHashes[id] != h {\n\t\t\tchanged = append(changed, id)\n\t\t}\n\t}","sourceCodeStart":1771,"sourceCodeEnd":1807,"githubUrl":"https://github.com/juanfont/headscale/blob/565fd254d06c4c7f9a8cad1714a43445c79ba420/hscontrol/policy/v2/policy.go#L1771-L1807","documentation":"Error \"compiling nodeAttrs: %w\" thrown in juanfont/headscale.","triggerScenarios":"Thrown at hscontrol/policy/v2/policy.go:1789 when the library encounters an invalid state.","commonSituations":"Compilation of nodeAttrs failed. Check nodeAttrs entries for unsupported features or invalid targets.","solutions":["Inspect the wrapped error for the underlying cause and correct the failing condition (compiling nodeAttrs); retry the operation after fixing the input, configuration, or environment."],"exampleFix":"Inspect the wrapped error for the underlying cause and correct the failing condition (compiling nodeAttrs); 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"}