{"record":{"id":"de288e49d313d92d","repo":"juanfont/headscale","slug":"sshtest-d-w","errorCode":null,"errorMessage":"sshTest %d: %w","messagePattern":"sshTest (.+?): %w","errorType":"validation","errorClass":"ErrSSHTestEmptySrc","httpStatus":null,"severity":"error","filePath":"hscontrol/policy/v2/types.go","lineNumber":3283,"sourceCode":"\t\t\tif p.Bits() < p.Addr().BitLen() {\n\t\t\t\treturn ErrTestDestinationCIDR\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}\n\n// validateSSHTests enforces parse-time shape on every sshTests entry:\n// non-empty src, at least one dst, and each dst describing a single\n// SSH-reachable host. Login-user assertions land with the engine so\n// failures surface through the same errSSHPolicyTestsFailed wrapper.\nfunc validateSSHTests(pol *Policy, tests []SSHPolicyTest) error {\n\tvar errs []error\n\n\tfor i, t := range tests {\n\t\tif t.Src == nil {\n\t\t\terrs = append(errs, fmt.Errorf(\"sshTest %d: %w\", i, ErrSSHTestEmptySrc))\n\t\t}\n\n\t\tif len(t.Dst) == 0 {\n\t\t\terrs = append(errs, fmt.Errorf(\"sshTest %d: %w\", i, ErrSSHTestEmptyDst))\n\t\t}\n\n\t\tfor _, dst := range t.Dst {\n\t\t\terr := validateSSHTestDestination(pol, dst)\n\t\t\tif err != nil {\n\t\t\t\terrs = append(errs, fmt.Errorf(\"sshTest %d: %w\", i, err))\n\t\t\t}\n\t\t}\n\t}\n\n\tif len(errs) > 0 {\n\t\treturn fmt.Errorf(\"%w:\\n%w\", errSSHPolicyTestsFailed, multierr.New(errs...))\n\t}\n","sourceCodeStart":3265,"sourceCodeEnd":3301,"githubUrl":"https://github.com/juanfont/headscale/blob/565fd254d06c4c7f9a8cad1714a43445c79ba420/hscontrol/policy/v2/types.go#L3265-L3301","documentation":"Error \"sshTest %d: %w\" thrown in juanfont/headscale.","triggerScenarios":"Thrown at hscontrol/policy/v2/types.go:3283 when the library encounters an invalid state.","commonSituations":"The numbered SSH test entry is invalid. Ensure it has a non-empty src and at least one dst.","solutions":["Inspect the wrapped error for the underlying cause and correct the failing condition (sshTest); retry the operation after fixing the input, configuration, or environment."],"exampleFix":"Inspect the wrapped error for the underlying cause and correct the failing condition (sshTest); retry the operation after fixing the input, configuration, or environment.","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"565fd254d06c4c7f9a8cad1714a43445c79ba420","analyzedAt":"2026-08-15T13:12:30.133Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}