{"record":{"id":"cc8cdbeacb39f751","repo":"hashicorp/nomad","slug":"failed-driver-config-validation-v-cc8cdb","errorCode":null,"errorMessage":"failed driver config validation: %v","messagePattern":"failed driver config validation: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/java/driver.go","lineNumber":443,"sourceCode":"\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 driverConfig.Class == \"\" && driverConfig.JarPath == \"\" {\n\t\treturn nil, nil, fmt.Errorf(\"jar_path or class must be specified\")\n\t}\n\n\tabsPath, err := GetAbsolutePath(\"java\")\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"failed to find java binary: %s\", err)\n\t}\n\n\targs := javaCmdArgs(driverConfig)\n\n\td.logger.Info(\"starting java task\", \"driver_cfg\", hclog.Fmt(\"%+v\", driverConfig), \"args\", args)\n\n\thandle = drivers.NewTaskHandle(taskHandleVersion)\n\thandle.Config = cfg\n","sourceCodeStart":425,"sourceCodeEnd":461,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/drivers/java/driver.go#L425-L461","documentation":"This error is returned by StartTask when the decoded TaskConfig fails driverConfig.validate(). Any of the driver's validation rules failed - for the Java driver this includes unsupported cap_add/cap_drop capabilities and a relative work_dir - and the underlying validation error is wrapped and returned. The task config is accepted at the API layer but invalid for this driver.","triggerScenarios":"Starting a Java task whose config violates validate(): unsupported capability in cap_add/cap_drop, or work_dir set to a non-absolute path.","commonSituations":"Capability lists referencing unsupported/misspelled capabilities; relative work_dir paths; configs validated on one host class but scheduled on another with fewer kernel capabilities.","solutions":["Read the wrapped inner error to see which validation rule failed and fix that field","Use 'nomad job validate' (which runs driver validation) before submitting the job","Correct cap_add/cap_drop to the host's supported capabilities and make work_dir absolute","Test the same job spec against the target client's driver with nomad node status / eval"],"exampleFix":"// before (HCL)\nconfig {\n  class = \"com.example.Main\"\n  work_dir = \"relative/dir\"\n}\n// after\nconfig {\n  class = \"com.example.Main\"\n  work_dir = \"/opt/app/relative/dir\"\n}","handlingStrategy":"validation","validationCode":"// pre-validate the java task config as the driver does\nimport \"github.com/hashicorp/nomad/client/lib/capabilities\"\n\nfunc validJavaCfg(tc java.TaskConfig) error {\n    supported := capabilities.Supported()\n    if !supported.Difference(capabilities.New(tc.CapAdd)).Empty() { return errors.New(\"bad cap_add\") }\n    if !supported.Difference(capabilities.New(tc.CapDrop)).Empty() { return errors.New(\"bad cap_drop\") }\n    if tc.WorkDir != \"\" && !filepath.IsAbs(tc.WorkDir) { return errors.New(\"relative work_dir\") }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"if _, _, err := driver.StartTask(cfg); err != nil {\n    if strings.Contains(err.Error(), \"failed driver config validation\") {\n        // inspect the wrapped cause and fix the offending field\n        return fmt.Errorf(\"java driver validation: %w\", err)\n    }\n}","preventionTips":["Run nomad job validate against the target node pool before submission","Keep capability lists within the host's supported set","Use absolute work_dir values everywhere","Read the wrapped validation error; it names the exact failing field"],"tags":["nomad","java-driver","validation","config"],"backgroundTag":"driver-config-validation-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"}