juanfont/headscale · error
alias not supported for SSH source
Error message
alias not supported for SSH source
What it means
Returned by SSHSrcAliases.UnmarshalJSON (hscontrol/policy/v2/types.go:2916) when an element of an SSH rule's src array decodes to an alias type other than *Username, *Group, *Tag, or *AutoGroup. SSH sources describe tailnet identities, so IP/CIDR literals and host aliases are structurally rejected at parse time.
Source
Thrown at hscontrol/policy/v2/types.go:143
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")
ErrSSHTestDstDisallowedElement = errors.New("SSH tests dst contains disallowed element")
)
type resolved struct {
ips netipx.IPSet
}
View on GitHub (pinned to 565fd254d0)
Solutions
- Express SSH src as a user ("alice@example.com"), group ("group:admin"), tag, or autogroup:member/tagged
- If IP-based restriction is the goal, constrain at the ACL layer instead — SSH rules cannot filter by address
- Check for stray quotes/typos that make an entry parse as an unexpected type
Example fix
// before
"ssh": [{"action": "accept", "src": ["100.64.0.1"], "dst": ["tag:server"], "users": ["root"]}]
// after
"ssh": [{"action": "accept", "src": ["group:admin"], "dst": ["tag:server"], "users": ["root"]}] Defensive patterns
Strategy: validation
Validate before calling
func validSSHSrc(s string) bool {
return strings.HasPrefix(s, "autogroup:") || strings.HasPrefix(s, "tag:") ||
strings.HasPrefix(s, "group:") || strings.Contains(s, "@")
} Type guard
func isSSHSourceAliasNotSupported(err error) bool {
return errors.Is(err, policy.ErrSSHSourceAliasNotSupported)
} Try / catch
if err := json.Unmarshal(b, &p); err != nil {
if errors.Is(err, policy.ErrSSHSourceAliasNotSupported) {
return fmt.Errorf("SSH src must be user/group/tag/autogroup (no IPs or hosts): %w", err)
}
return err
} Prevention
- SSH src entries are identities only — never IPs, CIDRs, or host aliases
- Constrain by IP at the ACL layer, not in ssh rules
- Add a lint rule rejecting digits-only or slash-containing strings in ssh src arrays
When it happens
Trigger: An SSH rule like {"src": ["100.64.0.1"], ...} or {"src": ["10.0.0.0/8"], ...} — raw addresses/prefixes decode to IP alias types and fail the switch. The error includes the Go type that was rejected (%T).
Common situations: Trying to SSH-allow by IP address (common instinct from sshd AllowUsers/Match Address); pasting an ACL src line that uses hosts or CIDRs into an ssh rule.
Related errors
- alias not supported for SSH destination
- tags in SSH source cannot access user-owned devices
- user destination requires source to contain only that same u
- autogroup:self destination requires source to contain only u
- tags in SSH source cannot access autogroup:member (user-owne
AI-assisted analysis of juanfont/headscale@565fd254d0 (2026-08-15).
Data as JSON: /api/errors/959a4cdb1d1096f1.
Report an issue: GitHub.