juanfont/headscale · error
parsing policy: %w
Error message
parsing policy: %w
What it means
Error "parsing policy: %w" thrown in juanfont/headscale.
Source
Thrown at hscontrol/policy/v2/policy.go:192
for _, src := range ssh.Sources {
checkAlias(src)
}
for _, dst := range ssh.Destinations {
checkAlias(dst)
}
}
return multierr.New(errs...)
}
// NewPolicyManager creates a new [PolicyManager] from a policy file and a list of users and nodes.
// It returns an error if the policy file is invalid.
// The policy manager will update the filter rules based on the users and nodes.
func NewPolicyManager(b []byte, users []types.User, nodes views.Slice[types.NodeView]) (*PolicyManager, error) {
policy, err := unmarshalPolicy(b)
if err != nil {
return nil, fmt.Errorf("parsing policy: %w", err)
}
err = validateUserReferences(policy, users)
if err != nil {
return nil, fmt.Errorf("validating policy user references: %w", err)
}
pm := PolicyManager{
pol: policy,
users: users,
nodes: nodes,
sshPolicyMap: xsync.NewMap[types.NodeID, *tailcfg.SSHPolicy](),
filterRulesMap: xsync.NewMap[types.NodeID, []tailcfg.FilterRule](),
matchersForNodeMap: xsync.NewMap[types.NodeID, []matcher.Match](),
}
_, err = pm.updateLocked()
if err != nil {View on GitHub (pinned to 565fd254d0)
Solutions
- Inspect the wrapped error for the underlying cause and correct the failing condition (parsing policy); 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 (parsing policy); retry the operation after fixing the input, configuration, or environment.
When it happens
Trigger: Thrown at hscontrol/policy/v2/policy.go:192 when the library encounters an invalid state.
Common situations: The policy (ACL) document could not be parsed. Validate the HuJSON syntax of the policy file before loading it.
AI-assisted analysis of juanfont/headscale@565fd254d0 (2026-08-15).
Data as JSON: /api/errors/4a25b8b1088feb53.
Report an issue: GitHub.