{"record":{"id":"76bae0d7576227e8","repo":"juanfont/headscale","slug":"checkperiod-s-w","errorCode":null,"errorMessage":"checkPeriod %s %w","messagePattern":"checkPeriod (.+?) %w","errorType":"validation","errorClass":"ErrSSHCheckPeriodNegative","httpStatus":null,"severity":"error","filePath":"hscontrol/policy/v2/types.go","lineNumber":2859,"sourceCode":"\n// MarshalJSON implements JSON marshaling for [SSHCheckPeriod].\nfunc (p SSHCheckPeriod) MarshalJSON() ([]byte, error) {\n\tif p.Always {\n\t\treturn []byte(`\"always\"`), nil\n\t}\n\n\treturn fmt.Appendf(nil, \"%q\", p.Duration.String()), nil\n}\n\n// Validate rejects negative durations and anything above the inclusive\n// 168h max.\nfunc (p *SSHCheckPeriod) Validate() error {\n\tif p.Always {\n\t\treturn nil\n\t}\n\n\tif p.Duration < 0 {\n\t\treturn fmt.Errorf(\"checkPeriod %s %w\", p.Duration, ErrSSHCheckPeriodNegative)\n\t}\n\n\tif p.Duration > SSHCheckPeriodMax {\n\t\treturn fmt.Errorf(\"checkPeriod %s %w\", p.Duration, ErrSSHCheckPeriodAboveMax)\n\t}\n\n\treturn nil\n}\n\n// SSH controls who can ssh into which machines.\ntype SSH struct {\n\tAction       SSHAction       `json:\"action\"`\n\tSources      SSHSrcAliases   `json:\"src\"`\n\tDestinations SSHDstAliases   `json:\"dst\"`\n\tUsers        SSHUsers        `json:\"users\"`\n\tCheckPeriod  *SSHCheckPeriod `json:\"checkPeriod,omitempty\"`\n\tAcceptEnv    []string        `json:\"acceptEnv,omitempty\"`\n}","sourceCodeStart":2841,"sourceCodeEnd":2877,"githubUrl":"https://github.com/juanfont/headscale/blob/565fd254d06c4c7f9a8cad1714a43445c79ba420/hscontrol/policy/v2/types.go#L2841-L2877","documentation":"Error \"checkPeriod %s %w\" thrown in juanfont/headscale.","triggerScenarios":"Thrown at hscontrol/policy/v2/types.go:2859 when the library encounters an invalid state.","commonSituations":"The SSH check rule's checkPeriod value is invalid. Use a positive duration no greater than 168h, and only with action \"check\".","solutions":["Inspect the wrapped error for the underlying cause and correct the failing condition (checkPeriod); retry the operation after fixing the input, configuration, or environment."],"exampleFix":"Inspect the wrapped error for the underlying cause and correct the failing condition (checkPeriod); 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"}