{"record":{"id":"2cffac5561d14158","repo":"hashicorp/nomad","slug":"failed-to-decode-driver-config-v-2cffac","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/rawexec/driver.go","lineNumber":402,"sourceCode":"\t\t\tenvList = append(envList, k+\"=\"+v)\n\t\t}\n\t}\n\tsort.Strings(envList)\n\treturn envList\n}\n\nfunc (d *Driver) StartTask(cfg *drivers.TaskConfig) (*drivers.TaskHandle, *drivers.DriverNetwork, error) {\n\tif !d.config.Enabled {\n\t\treturn nil, nil, errDisabledDriver\n\t}\n\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\tdriverConfig.OverrideCgroupV2 = cgroupslib.CustomPathCG2(driverConfig.OverrideCgroupV2)\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 err := d.Validate(*cfg); err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"failed driver config validation: %v\", err)\n\t}\n\n\td.logger.Info(\"starting task\", \"driver_cfg\", hclog.Fmt(\"%+v\", driverConfig))\n\thandle := drivers.NewTaskHandle(taskHandleVersion)\n\thandle.Config = cfg\n\n\tpluginLogFile := filepath.Join(cfg.TaskDir().Dir, \"executor.out\")\n\texecutorConfig := &executor.ExecutorConfig{","sourceCodeStart":384,"sourceCodeEnd":420,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/drivers/rawexec/driver.go#L384-L420","documentation":"StartTask could not decode the driver-specific TaskConfig out of the task's DriverConfig payload (cfg.DecodeDriverConfig). The job's driver config (e.g. command, args, cgroup fields) is not valid JSON matching the rawexec TaskConfig schema, or contains incompatible values/types.","triggerScenarios":"Submitting a job whose rawexec driver 'config' block does not unmarshal into drivers/rawexec TaskConfig — wrong field names/types, unknown required fields, or hcl2/template output producing an unexpected shape.","commonSituations":"Typo'd job config keys (e.g. 'comand' instead of 'command'); passing a string where a bool/int is expected; job written for a different driver or newer Nomad with fields this version lacks; programmatic job JSON with wrong nesting.","solutions":["Validate the job with nomad job validate / nomad job run -output to see the decoded driver config","Compare your config block keys/types against the rawexec TaskConfig fields for your Nomad version (command, args, cgroup_v2, oom_score_adj, etc.)","Fix field names, types, and nesting in the job spec and resubmit","Upgrade/downgrade so job spec and Nomad agent versions agree"],"exampleFix":"// before (typo/type error in job hcl2)\nconfig {\n  comand = \"/bin/sleep\"\n  args   = [\"10\"]\n}\n// after\nconfig {\n  command = \"/bin/sleep\"\n  args    = [\"10\"]\n}","handlingStrategy":"validation","validationCode":"// validate the job spec before submit\n// $ nomad job validate job.nomad.hcl\n// or programmatically:\nif driverCfg, ok := taskConfig[\"rawexec\"]; !ok {\n  return errors.New(\"rawexec config block missing\")\n} else if _, ok := driverCfg[\"command\"]; !ok {\n  return errors.New(\"rawexec requires 'command'\")\n}","typeGuard":null,"tryCatchPattern":"h, net, err := d.StartTask(cfg)\nif err != nil && strings.Contains(err.Error(), \"failed to decode driver config\") {\n  return fmt.Errorf(\"job spec rawexec config invalid: %w\", err)\n}","preventionTips":["Always run 'nomad job validate' in CI before deploying jobs","Copy config keys from official rawexec docs for your Nomad version","Generate job JSON via nomad job run -output rather than hand-writing JSON","Pin Nomad versions so jobspec schema matches agent"],"tags":["nomad","rawexec","config","decoding","jobspec"],"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"}