{"record":{"id":"505d49daf2e4ffd1","repo":"juanfont/headscale","slug":"w-d-505d49","errorCode":null,"errorMessage":"%w: %d","messagePattern":"%w: %d","errorType":"http","errorClass":"ErrNodeNotInNodeStore","httpStatus":404,"severity":"error","filePath":"hscontrol/state/state.go","lineNumber":543,"sourceCode":"\t// behind a concurrent admin write such as SetNodeTags. Serialising the\n\t// read+write keeps the database row converging on [NodeStore] instead of\n\t// reverting it to an out-of-date column set.\n\t//\n\t// The same re-read also guards against the node having been deleted (e.g.\n\t// ephemeral logout) between the caller's update and this persist: a missing\n\t// node means we must not re-insert it.\n\ts.persistMu.Lock()\n\n\tfresh, exists := s.nodeStore.GetNode(node.ID())\n\tif !exists {\n\t\ts.persistMu.Unlock()\n\n\t\tlog.Warn().\n\t\t\tEmbedObject(node).\n\t\t\tBool(\"is_ephemeral\", node.IsEphemeral()).\n\t\t\tMsg(\"Node no longer exists in NodeStore, skipping database persist to prevent race condition\")\n\n\t\treturn types.NodeView{}, fmt.Errorf(\"%w: %d\", ErrNodeNotInNodeStore, node.ID())\n\t}\n\n\tnodePtr := fresh.AsStruct()\n\n\t// Explicitly select all node columns so GORM includes nil/zero-value\n\t// fields (e.g. UserID=nil when converting a user-owned node to tagged).\n\t// Omit \"Expiry\" here: expiry is only updated through explicit\n\t// SetNodeExpiry calls or re-registration, not during MapRequest updates.\n\terr := s.db.DB.Select(nodeUpdateColumns).Omit(\"Expiry\").Updates(nodePtr).Error\n\ts.persistMu.Unlock()\n\n\tif err != nil {\n\t\treturn types.NodeView{}, fmt.Errorf(\"saving node: %w\", err)\n\t}\n\n\treturn fresh, nil\n}\n","sourceCodeStart":525,"sourceCodeEnd":561,"githubUrl":"https://github.com/juanfont/headscale/blob/565fd254d06c4c7f9a8cad1714a43445c79ba420/hscontrol/state/state.go#L525-L561","documentation":"Error \"%w: %d\" thrown in juanfont/headscale.","triggerScenarios":"Thrown at hscontrol/state/state.go:543 when the library encounters an invalid state.","commonSituations":"A state lookup for the numeric ID failed. Verify the referenced node or user ID exists.","solutions":["Inspect the wrapped error for the underlying cause and correct the failing condition (); retry the operation after fixing the input, configuration, or environment."],"exampleFix":"Inspect the wrapped error for the underlying cause and correct the failing condition (); 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"}