juanfont/headscale · error

"autogroup:self" not valid on the src side of a rule

Error message

"autogroup:self" not valid on the src side of a rule

What it means

Returned by validateAutogroupForSrc (hscontrol/policy/v2/types.go:2042) when autogroup:self appears on the src side of an ACL rule. autogroup:self means 'the requesting node itself' and is only meaningful in destinations, where it grants each node access to its own ports; as a source it would be a no-op tautology and Tailscale/headscale reject it.

Source

Thrown at hscontrol/policy/v2/types.go:136

	ErrHostportMissingColon        = errors.New("hostport must contain a colon")
	ErrTypeNotSupported            = errors.New("type not supported")
	ErrInvalidAlias                = errors.New("invalid alias format")
	ErrInvalidAutoApprover         = errors.New("invalid auto approver format")
	ErrInvalidOwner                = errors.New("invalid owner format")
	ErrGroupNotDefined             = errors.New("group not defined in policy")
	ErrInvalidGroupMember          = errors.New("invalid group member type")
	ErrGroupValueNotArray          = errors.New("group value must be an array of users")
	ErrInvalidHostIP               = errors.New("hostname contains invalid IP address")
	ErrTagNotDefined               = errors.New("tag not found")
	ErrAutoApproverNotAlias        = errors.New("auto approver is not an alias")
	ErrInvalidACLAction            = errors.New("invalid ACL action")
	ErrInvalidSSHAction            = errors.New("invalid SSH action")
	ErrInvalidProtocolNumber       = errors.New("invalid protocol number")
	ErrProtocolLeadingZero         = errors.New("leading 0 not permitted in protocol number")
	ErrProtocolOutOfRange          = errors.New("protocol number out of range (0-255)")
	ErrAutogroupNotSupported       = errors.New("autogroup not supported in headscale")
	ErrAutogroupInternetSrc        = errors.New("autogroup:internet can only be used in ACL destinations")
	ErrAutogroupSelfSrc            = errors.New("\"autogroup:self\" not valid on the src side of a rule")
	ErrAutogroupNotSupportedACLSrc = errors.New("autogroup not supported for ACL sources")
	ErrAutogroupNotSupportedACLDst = errors.New("autogroup not supported for ACL destinations")
	ErrAutogroupDangerAllDst       = errors.New("cannot use autogroup:danger-all as a dst")
	ErrAutogroupNotSupportedSSHSrc = errors.New("autogroup not supported for SSH sources")
	ErrAutogroupNotSupportedSSHDst = errors.New("autogroup not supported for SSH destinations")
	ErrHostNotDefined              = errors.New("host not defined in policy")
	ErrSSHSourceAliasNotSupported  = errors.New("alias not supported for SSH source")
	ErrSSHDestAliasNotSupported    = errors.New("alias not supported for SSH destination")
	ErrUnknownField                = errors.New("unknown field")
	ErrProtocolNoSpecificPorts     = errors.New("protocol does not support specific ports")
	ErrTestEmptyAssertions         = errors.New("test entry must have at least one of \"accept\" or \"deny\"")
	ErrTestProtocolNotAllowed      = errors.New("test protocol must be tcp, udp, sctp, or empty")
	ErrTestDestinationMultiPort    = errors.New("test destination port must be a single port")
	ErrTestDestinationCIDR         = errors.New("test destination must be a single host, not a CIDR range")
	ErrAutogroupInternetTestDst    = errors.New("autogroup:internet not valid as a test destination")
	ErrSSHTestEmptySrc             = errors.New("SSH tests entry must have a non-empty src")
	ErrSSHTestEmptyDst             = errors.New("SSH tests entry must have at least one dst")
	ErrSSHTestDstUnknownTag        = errors.New("SSH tests dst contains unknown tag")

View on GitHub (pinned to 565fd254d0)

Solutions

  1. Remove autogroup:self from src; sources should name users, groups, tags, hosts, or autogroup:member/tagged/danger-all
  2. For 'each node may talk to itself', put autogroup:self on the dst side: src ["*"], dst ["autogroup:self:*"]

Example fix

// before
{"action": "accept", "proto": "tcp", "src": ["autogroup:self"], "dst": ["*:80"]}

// after
{"action": "accept", "proto": "tcp", "src": ["*"], "dst": ["autogroup:self:80"]}
Defensive patterns

Strategy: validation

Validate before calling

for _, acl := range acls {
	for _, s := range acl.Src {
		if s == "autogroup:self" {
			return errors.New("autogroup:self not valid on src")
		}
	}
}

Type guard

func isAutogroupSelfSrc(err error) bool {
	return errors.Is(err, policy.ErrAutogroupSelfSrc)
}

Try / catch

if err := p.Validate(); err != nil {
	if errors.Is(err, policy.ErrAutogroupSelfSrc) {
		return fmt.Errorf("remove autogroup:self from src; use it in dst for self-access: %w", err)
	}
	return err
}

Prevention

When it happens

Trigger: Policy with "acls": [{"action": "accept", "src": ["autogroup:self"], "dst": ["*:80"]}]. Any ACL rule listing autogroup:self under src triggers this during Policy.validate.

Common situations: Trying to express 'a node can act as a source for itself' (already implicit), or copy-pasting a dst-focused self rule into src. Users modeling per-node permissions often land here before learning the self-as-dst idiom.

Related errors


AI-assisted analysis of juanfont/headscale@565fd254d0 (2026-08-15). Data as JSON: /api/errors/2109afe41c1e3395. Report an issue: GitHub.