{"record":{"id":"9d1769b81fac50cd","repo":"hashicorp/nomad","slug":"error-parsing-deadline-w","errorCode":null,"errorMessage":"error parsing Deadline: %w","messagePattern":"error parsing Deadline: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/config/drain.go","lineNumber":43,"sourceCode":"\tForce bool\n}\n\n// DrainConfigFromAgent creates the internal read-only copy of the client\n// agent's DrainConfig.\nfunc DrainConfigFromAgent(c *config.DrainConfig) (*DrainConfig, error) {\n\tif c == nil {\n\t\treturn nil, nil\n\t}\n\n\tdeadline := time.Hour\n\tignoreSystemJobs := false\n\tforce := false\n\n\tif c.Deadline != nil {\n\t\tvar err error\n\t\tdeadline, err = time.ParseDuration(*c.Deadline)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error parsing Deadline: %w\", err)\n\t\t}\n\t}\n\tif c.IgnoreSystemJobs != nil {\n\t\tignoreSystemJobs = *c.IgnoreSystemJobs\n\t}\n\tif c.Force != nil {\n\t\tforce = *c.Force\n\t}\n\n\treturn &DrainConfig{\n\t\tDeadline:         deadline,\n\t\tIgnoreSystemJobs: ignoreSystemJobs,\n\t\tForce:            force,\n\t}, nil\n}\n","sourceCodeStart":25,"sourceCodeEnd":59,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/client/config/drain.go#L25-L59","documentation":"DrainConfigFromAgent converts the agent's drain config; when a Deadline is set, time.ParseDuration fails on a malformed duration string, so node drain metadata cannot be translated into the client's DrainConfig.","triggerScenarios":"Thrown at client/config/drain.go:43 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the drain deadline in the agent config to a valid duration (e.g. \"1h\")","Validate the deadline before sending the drain spec"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}