juanfont/headscale · error · ErrTestProtocolNotAllowed

test %d: %w: %q

Error message

test %d: %w: %q

What it means

Error "test %d: %w: %q" thrown in juanfont/headscale.

Source

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

// validateTests enforces the four shape rules a tests-block entry must
// follow: a tests entry describes one connection attempt to one specific
// destination port over a connection-oriented protocol and asserts
// whether that attempt is allowed or denied. The same shapes remain
// valid inside [ACL] or [Grant] destinations where the rule does not apply.
func validateTests(pol *Policy, tests []PolicyTest) error {
	var errs []error

	for i, t := range tests {
		if len(t.Accept) == 0 && len(t.Deny) == 0 {
			errs = append(errs, fmt.Errorf("test %d: %w", i, ErrTestEmptyAssertions))
		}

		if t.Proto != "" &&
			t.Proto != ProtocolNameTCP &&
			t.Proto != ProtocolNameUDP &&
			t.Proto != ProtocolNameSCTP {
			errs = append(errs, fmt.Errorf("test %d: %w: %q", i, ErrTestProtocolNotAllowed, t.Proto))
		}

		for _, dst := range t.Accept {
			err := validateTestDestination(pol, dst)
			if err != nil {
				errs = append(errs, fmt.Errorf("test %d, accept %q: %w", i, dst, err))
			}
		}

		for _, dst := range t.Deny {
			err := validateTestDestination(pol, dst)
			if err != nil {
				errs = append(errs, fmt.Errorf("test %d, deny %q: %w", i, dst, err))
			}
		}
	}

	if len(errs) > 0 {

View on GitHub (pinned to 565fd254d0)

Solutions

  1. Inspect the wrapped error for the underlying cause and correct the failing condition (test); 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 (test); retry the operation after fixing the input, configuration, or environment.

When it happens

Trigger: Thrown at hscontrol/policy/v2/types.go:3209 when the library encounters an invalid state.

Common situations: The numbered policy test references an invalid value. Check the quoted entry in that test for typos or undefined aliases.


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