{"record":{"id":"aada10828f70ff6d","repo":"portainer/portainer","slug":"graceperiodseconds-must-be-1-or-a-positive-number","errorCode":null,"errorMessage":"gracePeriodSeconds must be -1 or a positive number of seconds","messagePattern":"gracePeriodSeconds must be -1 or a positive number of seconds","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"api/http/handler/kubernetes/node.go","lineNumber":48,"sourceCode":"\t// TimeoutSeconds is the overall time to wait for the drain to complete. Defaults to 60 when omitted.\n\tTimeoutSeconds *int `example:\"60\"`\n\t// GracePeriodSeconds overrides each pod's termination grace period. -1 uses the pod's own grace period.\n\tGracePeriodSeconds *int `example:\"-1\"`\n\t// IgnoreDaemonSets skips DaemonSet-managed pods, which would otherwise block the drain.\n\tIgnoreDaemonSets *bool `example:\"true\"`\n\t// DeleteEmptyDirData allows eviction of pods using emptyDir volumes, whose data is lost once the pod is deleted.\n\tDeleteEmptyDirData *bool `example:\"true\"`\n\t// DisableEviction forces the use of direct pod deletion instead of the eviction API, ignoring any configured PodDisruptionBudgets.\n\tDisableEviction *bool `example:\"false\"`\n}\n\nfunc (payload *drainNodePayload) Validate(r *http.Request) error {\n\tif payload.TimeoutSeconds != nil && *payload.TimeoutSeconds < 0 {\n\t\treturn errors.New(\"timeoutSeconds must be zero or a positive number of seconds\")\n\t}\n\n\tif payload.GracePeriodSeconds != nil && *payload.GracePeriodSeconds < -1 {\n\t\treturn errors.New(\"gracePeriodSeconds must be -1 or a positive number of seconds\")\n\t}\n\n\treturn nil\n}\n\nfunc (payload *drainNodePayload) drainOptions() libkubectl.DrainOptions {\n\topts := libkubectl.DefaultDrainOptions()\n\tif payload.Force != nil {\n\t\topts.Force = *payload.Force\n\t}\n\tif payload.GracePeriodSeconds != nil {\n\t\topts.GracePeriodSeconds = *payload.GracePeriodSeconds\n\t}\n\tif payload.IgnoreDaemonSets != nil {\n\t\topts.IgnoreAllDaemonSets = *payload.IgnoreDaemonSets\n\t}\n\tif payload.DeleteEmptyDirData != nil {\n\t\topts.DeleteEmptyDirData = *payload.DeleteEmptyDirData","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/portainer/portainer/blob/17e74456ff6e794b9d5439ec3fa06922aa18a3f8/api/http/handler/kubernetes/node.go#L30-L66","documentation":"Error \"gracePeriodSeconds must be -1 or a positive number of seconds\" thrown in portainer/portainer.","triggerScenarios":"Thrown at api/http/handler/kubernetes/node.go:48 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"17e74456ff6e794b9d5439ec3fa06922aa18a3f8","analyzedAt":"2026-08-26T23:09:01.915Z","schemaVersion":2},"datasetVersion":"2026-08-27T03:17:27.898Z"}