juanfont/headscale · error · ErrSSHTestEmptySrc

sshTest %d: %w

Error message

sshTest %d: %w

What it means

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

Source

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

			if p.Bits() < p.Addr().BitLen() {
				return ErrTestDestinationCIDR
			}
		}
	}

	return nil
}

// validateSSHTests enforces parse-time shape on every sshTests entry:
// non-empty src, at least one dst, and each dst describing a single
// SSH-reachable host. Login-user assertions land with the engine so
// failures surface through the same errSSHPolicyTestsFailed wrapper.
func validateSSHTests(pol *Policy, tests []SSHPolicyTest) error {
	var errs []error

	for i, t := range tests {
		if t.Src == nil {
			errs = append(errs, fmt.Errorf("sshTest %d: %w", i, ErrSSHTestEmptySrc))
		}

		if len(t.Dst) == 0 {
			errs = append(errs, fmt.Errorf("sshTest %d: %w", i, ErrSSHTestEmptyDst))
		}

		for _, dst := range t.Dst {
			err := validateSSHTestDestination(pol, dst)
			if err != nil {
				errs = append(errs, fmt.Errorf("sshTest %d: %w", i, err))
			}
		}
	}

	if len(errs) > 0 {
		return fmt.Errorf("%w:\n%w", errSSHPolicyTestsFailed, multierr.New(errs...))
	}

View on GitHub (pinned to 565fd254d0)

Solutions

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

When it happens

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

Common situations: The numbered SSH test entry is invalid. Ensure it has a non-empty src and at least one dst.


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