{"record":{"id":"1db02f4e2473be1f","repo":"hashicorp/nomad","slug":"failed-to-decode-driver-config-v-1db02f","errorCode":null,"errorMessage":"failed to decode driver config: %v","messagePattern":"failed to decode driver config: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/exec/driver.go","lineNumber":465,"sourceCode":"\t\tstartedAt:    taskState.StartedAt,\n\t\texitResult:   &drivers.ExitResult{},\n\t\tlogger:       d.logger,\n\t}\n\n\td.tasks.Set(taskState.TaskConfig.ID, h)\n\n\tgo h.run()\n\treturn nil\n}\n\nfunc (d *Driver) StartTask(cfg *drivers.TaskConfig) (handle *drivers.TaskHandle, network *drivers.DriverNetwork, err error) {\n\tif _, ok := d.tasks.Get(cfg.ID); ok {\n\t\treturn nil, nil, fmt.Errorf(\"task with ID %q already started\", cfg.ID)\n\t}\n\n\tvar driverConfig TaskConfig\n\tif err := cfg.DecodeDriverConfig(&driverConfig); err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"failed to decode driver config: %v\", err)\n\t}\n\n\tif err := driverConfig.validate(); err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"failed driver config validation: %v\", err)\n\t}\n\n\tif cfg.User == \"\" {\n\t\tcfg.User = \"nobody\"\n\t}\n\n\td.logger.Debug(\"setting up user\", \"user\", cfg.User)\n\n\tif err := d.userIDValidator.HasValidIDs(cfg.User); err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"failed host user validation: %v\", err)\n\t}\n\n\td.logger.Info(\"starting task\", \"driver_cfg\", hclog.Fmt(\"%+v\", driverConfig))\n\thandle = drivers.NewTaskHandle(taskHandleVersion)","sourceCodeStart":447,"sourceCodeEnd":483,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/drivers/exec/driver.go#L447-L483","documentation":"StartTask decodes the opaque driver configuration map from the TaskConfig into the exec driver's TaskConfig struct via cfg.DecodeDriverConfig. If the payload cannot be decoded (wrong types, unknown/invalid fields, malformed hcl/json), the task is not started. This surfaces misconfiguration between the job spec and the driver schema.","triggerScenarios":"Job spec exec driver options do not match the TaskConfig struct fields (e.g., non-boolean for a bool option, wrong nesting), or the encoded payload was produced by an incompatible Nomad version.","commonSituations":"Typo'd or mis-typed driver options in the job 'config' block; using raw_exec-style options with the exec driver; client and server Nomad versions out of sync so config schemas differ.","solutions":["Fix the driver 'config' block in the job spec so keys and value types match the exec driver's TaskConfig schema.","Run 'nomad job validate' / 'nomad plan' to catch schema mismatches before submission.","Ensure client and server Nomad versions are compatible for the driver options used."],"exampleFix":"// before (job config)\nconfig {\n  command = \"/bin/sleep\"\n  args    = [\"1\"]\n  caps    = true // unknown/wrong-typed option\n}\n// after\nconfig {\n  command = \"/bin/sleep\"\n  args    = [\"1\"]\n}","handlingStrategy":"validation","validationCode":"// validate the job (and its driver config) before submission\n// $ nomad job validate job.nomad.hcl\n// programmatically:\n_, _, err := client.Jobs().Validate(job, nil)\nif err != nil {\n    return fmt.Errorf(\"job driver config invalid: %w\", err)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run 'nomad job validate' in CI for every job spec change.","Keep client and server Nomad versions within supported skew.","Only use documented exec driver config keys; check the docs for your Nomad version."],"tags":["nomad","exec-driver","config-decode","job-spec"],"backgroundTag":"driver-config-decode-failed","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"}