{"record":{"id":"b0d4bcf03ae47c30","repo":"hashicorp/nomad","slug":"missing-task-driver","errorCode":null,"errorMessage":"Missing task driver","messagePattern":"Missing task driver","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/structs/structs.go","lineNumber":8247,"sourceCode":"\tvar mErr multierror.Error\n\tif t.Name == \"\" {\n\t\tmErr.Errors = append(mErr.Errors, errors.New(\"Missing task name\"))\n\t}\n\n\t// Tasks cannot be named \"alloc\" as this conflicts with and breaks task\n\t// filesystem isolation features.\n\tif t.Name == \"alloc\" {\n\t\tmErr.Errors = append(mErr.Errors, errors.New(\"Task cannot be named \\\"alloc\\\"\"))\n\t}\n\tif strings.ContainsAny(t.Name, `/\\`) {\n\t\t// We enforce this so that when creating the directory on disk it will\n\t\t// not have any slashes.\n\t\tmErr.Errors = append(mErr.Errors, errors.New(\"Task name cannot include slashes\"))\n\t} else if strings.Contains(t.Name, \"\\000\") {\n\t\tmErr.Errors = append(mErr.Errors, errors.New(\"Task name cannot include null characters\"))\n\t}\n\tif t.Driver == \"\" {\n\t\tmErr.Errors = append(mErr.Errors, errors.New(\"Missing task driver\"))\n\t}\n\tif t.KillTimeout < 0 {\n\t\tmErr.Errors = append(mErr.Errors, errors.New(\"KillTimeout must be a positive value\"))\n\t} else {\n\t\t// Validate the group's update strategy does not conflict with the\n\t\t// task's kill_timeout for service jobs.\n\t\t//\n\t\t// progress_deadline = 0 has a special meaning so it should not be\n\t\t// validated against the task's kill_timeout.\n\t\tconflictsWithProgressDeadline := jobType == JobTypeService &&\n\t\t\ttg.Update != nil &&\n\t\t\ttg.Update.ProgressDeadline > 0 &&\n\t\t\tt.KillTimeout > tg.Update.ProgressDeadline\n\t\tif conflictsWithProgressDeadline {\n\t\t\tmErr.Errors = append(mErr.Errors, fmt.Errorf(\"KillTimout (%s) longer than the group's ProgressDeadline (%s)\",\n\t\t\t\tt.KillTimeout, tg.Update.ProgressDeadline))\n\t\t}\n\t}","sourceCodeStart":8229,"sourceCodeEnd":8265,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/structs.go#L8229-L8265","documentation":"Task.Validate requires a non-empty Driver; the driver string selects which task runner (docker, exec, java, etc.) executes the task. Without a driver Nomad cannot launch the task, so validation fails.","triggerScenarios":"A task block without a `driver` field, or structs.Task with Driver unset when constructed programmatically.","commonSituations":"Hand-written HCL omitting driver; generated jobs where the driver was conditional and defaulted to empty.","solutions":["Set the driver field, e.g. driver = \"docker\".","Ensure only drivers enabled in the client config are used (a separate runtime error otherwise).","Validate before submit."],"exampleFix":"// before\ntask \"app\" {\n  config {\n    image = \"nginx\"\n  }\n}\n// after\ntask \"app\" {\n  driver = \"docker\"\n  config {\n    image = \"nginx\"\n  }\n}","handlingStrategy":"validation","validationCode":"if t.Driver == \"\" {\n  return fmt.Errorf(\"task %q missing driver\", t.Name)\n}","typeGuard":"func hasDriver(t *structs.Task) bool {\n  return t != nil && t.Driver != \"\"\n}","tryCatchPattern":null,"preventionTips":["Always set driver in every task block.","Keep a list of client-supported drivers and check before deploy.","Run `nomad job validate` in CI.","Avoid optional/conditional driver blocks in generators."],"tags":["nomad","task","driver","validation"],"backgroundTag":"missing-required-argument","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"}