{"record":{"id":"8471f49df278e852","repo":"hashicorp/nomad","slug":"pid-mode-must-be-q-or-q-got-q-8471f4","errorCode":null,"errorMessage":"pid_mode must be %q or %q, got %q","messagePattern":"pid_mode must be %q or %q, got %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/java/driver.go","lineNumber":202,"sourceCode":"\t// ModeIPC indicates whether IPC namespace isolation is enabled for the task.\n\t// Must be \"private\" or \"host\" if set.\n\tModeIPC string `codec:\"ipc_mode\"`\n\n\t// CapAdd is a set of linux capabilities to enable.\n\tCapAdd []string `codec:\"cap_add\"`\n\n\t// CapDrop is a set of linux capabilities to disable.\n\tCapDrop []string `codec:\"cap_drop\"`\n\n\t// WorkDir is the working directory for the task\n\tWorkDir string `codec:\"work_dir\"`\n}\n\nfunc (tc *TaskConfig) validate() error {\n\tswitch tc.ModePID {\n\tcase \"\", executor.IsolationModePrivate, executor.IsolationModeHost:\n\tdefault:\n\t\treturn fmt.Errorf(\"pid_mode must be %q or %q, got %q\", executor.IsolationModePrivate, executor.IsolationModeHost, tc.ModePID)\n\n\t}\n\n\tswitch tc.ModeIPC {\n\tcase \"\", executor.IsolationModePrivate, executor.IsolationModeHost:\n\tdefault:\n\t\treturn fmt.Errorf(\"ipc_mode must be %q or %q, got %q\", executor.IsolationModePrivate, executor.IsolationModeHost, tc.ModeIPC)\n\t}\n\n\tsupported := capabilities.Supported()\n\tbadAdds := supported.Difference(capabilities.New(tc.CapAdd))\n\tif !badAdds.Empty() {\n\t\treturn fmt.Errorf(\"cap_add configured with capabilities not supported by system: %s\", badAdds)\n\t}\n\tbadDrops := supported.Difference(capabilities.New(tc.CapDrop))\n\tif !badDrops.Empty() {\n\t\treturn fmt.Errorf(\"cap_drop configured with capabilities not supported by system: %s\", badDrops)\n\t}","sourceCodeStart":184,"sourceCodeEnd":220,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/drivers/java/driver.go#L184-L220","documentation":"TaskConfig.validate() checks the task-level pid_mode (ModePID). Unlike the plugin-level config, empty string is allowed (falls back to the driver default), but any non-empty value other than \"private\" or \"host\" is rejected when the task is validated.","triggerScenarios":"A java task's config sets pid_mode to a value other than \"\", \"private\", or \"host\".","commonSituations":"Job spec typos (\"isolated\", \"container\"); case mismatches; copying docker driver's pid_mode values that don't apply; whitespace in the value.","solutions":["Set pid_mode to \"private\" or \"host\", or remove the field to use the driver default.","Trim whitespace and check casing in the job file (HCL).","Validate the job with `nomad job validate` before submitting."],"exampleFix":"// before\ntask \"app\" {\n  driver = \"java\"\n  config {\n    pid_mode = \"container\"\n  }\n}\n// after\ntask \"app\" {\n  driver = \"java\"\n  config {\n    pid_mode = \"private\"\n  }\n}","handlingStrategy":"validation","validationCode":"mode := taskCfg[\"pid_mode\"]\nif mode != \"\" && mode != \"private\" && mode != \"host\" {\n    return fmt.Errorf(\"pid_mode must be '' (default), 'private' or 'host', got %q\", mode)\n}","typeGuard":null,"tryCatchPattern":"if err := driver.StartTask(cfg); err != nil && strings.Contains(err.Error(), \"pid_mode\") {\n    return fmt.Errorf(\"fix pid_mode in task config: %w\", err)\n}","preventionTips":["Run `nomad job validate` before submitting jobs.","Omit pid_mode to accept the driver default.","Use lowercase \"private\"/\"host\" only."],"tags":["java-driver","job-spec","config-validation","nomad"],"backgroundTag":"invalid-config-value","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"}