juanfont/headscale · error
saving node: %w
Error message
saving node: %w
What it means
Error "saving node: %w" thrown in juanfont/headscale.
Source
Thrown at hscontrol/state/state.go:556
log.Warn().
EmbedObject(node).
Bool("is_ephemeral", node.IsEphemeral()).
Msg("Node no longer exists in NodeStore, skipping database persist to prevent race condition")
return types.NodeView{}, fmt.Errorf("%w: %d", ErrNodeNotInNodeStore, node.ID())
}
nodePtr := fresh.AsStruct()
// Explicitly select all node columns so GORM includes nil/zero-value
// fields (e.g. UserID=nil when converting a user-owned node to tagged).
// Omit "Expiry" here: expiry is only updated through explicit
// SetNodeExpiry calls or re-registration, not during MapRequest updates.
err := s.db.DB.Select(nodeUpdateColumns).Omit("Expiry").Updates(nodePtr).Error
s.persistMu.Unlock()
if err != nil {
return types.NodeView{}, fmt.Errorf("saving node: %w", err)
}
return fresh, nil
}
// persistNodeToDB saves the given node state to the database and refreshes the
// policy manager. The exact row written comes from [NodeStore]; see
// [State.persistNodeRowToDB].
func (s *State) persistNodeToDB(node types.NodeView) (types.NodeView, change.Change, error) {
fresh, err := s.persistNodeRowToDB(node)
if err != nil {
return types.NodeView{}, change.Change{}, err
}
// Check if policy manager needs updating
c, err := s.updatePolicyManagerNodes()
if err != nil {
return fresh, change.Change{}, fmt.Errorf("updating policy manager after node save: %w", err)View on GitHub (pinned to 565fd254d0)
Solutions
- Inspect the wrapped error for the underlying cause and correct the failing condition (saving node); retry the operation after fixing the input, configuration, or environment.
Example fix
Inspect the wrapped error for the underlying cause and correct the failing condition (saving node); retry the operation after fixing the input, configuration, or environment.
When it happens
Trigger: Thrown at hscontrol/state/state.go:556 when the library encounters an invalid state.
Common situations: Persisting the node failed. Check database availability and that the node's fields (name, keys) are valid and unique.
AI-assisted analysis of juanfont/headscale@565fd254d0 (2026-08-15).
Data as JSON: /api/errors/63ae4e510437e460.
Report an issue: GitHub.