{"record":{"id":"df9db920b0b14ee6","repo":"hashicorp/nomad","slug":"default-pid-mode-must-be-q-or-q-got-q","errorCode":null,"errorMessage":"default_pid_mode must be %q or %q, got %q","messagePattern":"default_pid_mode must be %q or %q, got %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/exec/driver.go","lineNumber":176,"sourceCode":"\tDefaultModePID string `codec:\"default_pid_mode\"`\n\n\t// DefaultModeIPC is the default IPC isolation set for all tasks using\n\t// exec-based task drivers.\n\tDefaultModeIPC string `codec:\"default_ipc_mode\"`\n\n\t// AllowCaps configures which Linux Capabilities are enabled for tasks\n\t// running on this node.\n\tAllowCaps []string `codec:\"allow_caps\"`\n\n\tDeniedHostUids string `codec:\"denied_host_uids\"`\n\tDeniedHostGids string `codec:\"denied_host_gids\"`\n}\n\nfunc (c *Config) validate() error {\n\tswitch c.DefaultModePID {\n\tcase executor.IsolationModePrivate, executor.IsolationModeHost:\n\tdefault:\n\t\treturn fmt.Errorf(\"default_pid_mode must be %q or %q, got %q\", executor.IsolationModePrivate, executor.IsolationModeHost, c.DefaultModePID)\n\t}\n\n\tswitch c.DefaultModeIPC {\n\tcase executor.IsolationModePrivate, executor.IsolationModeHost:\n\tdefault:\n\t\treturn fmt.Errorf(\"default_ipc_mode must be %q or %q, got %q\", executor.IsolationModePrivate, executor.IsolationModeHost, c.DefaultModeIPC)\n\t}\n\n\tbadCaps := capabilities.Supported().Difference(capabilities.New(c.AllowCaps))\n\tif !badCaps.Empty() {\n\t\treturn fmt.Errorf(\"allow_caps configured with capabilities not supported by system: %s\", badCaps)\n\t}\n\n\treturn nil\n}\n\n// TaskConfig is the driver configuration of a task within a job\ntype TaskConfig struct {","sourceCodeStart":158,"sourceCodeEnd":194,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/drivers/exec/driver.go#L158-L194","documentation":"The exec driver's Config.validate() requires DefaultModePID to be exactly executor.IsolationModePrivate or executor.IsolationModeHost; anything else (empty string, \"none\", typos) fails. This config check runs when the driver plugin receives its configuration via SetConfig.","triggerScenarios":"Setting default_pid_mode in the exec driver plugin config on a Nomad client to any value other than \"private\" or \"host\", including omitting it (empty string) when no default is applied.","commonSituations":"Typo in client HCL (\"default_pid_mode = pubilc\"), copy-pasted Docker-driver values like \"bridge\", or upgrading Nomad where the previously-accepted value was removed.","solutions":["Set default_pid_mode = \"private\" (recommended) or \"host\" in the exec driver plugin config.","Fix spelling/case; values are matched exactly against executor.IsolationModePrivate/Host.","Remove the key entirely if you only need task-level PID isolation overrides and the driver supports absent defaults.","Also verify the companion default_ipc_mode, validated the same way."],"exampleFix":"// before (client HCL)\nplugin \"exec\" {\n  config { default_pid_mode = \"none\" }\n}\n// after\nplugin \"exec\" {\n  config { default_pid_mode = \"private\" }\n}","handlingStrategy":"validation","validationCode":"allowed := map[string]bool{\"private\": true, \"host\": true}\nif !allowed[strings.ToLower(cfg.DefaultModePID)] {\n  return fmt.Errorf(\"default_pid_mode %q invalid; use private or host\", cfg.DefaultModePID)\n}","typeGuard":null,"tryCatchPattern":"if err := cfg.validate(); err != nil {\n  return fmt.Errorf(\"exec driver config rejected: %w\", err)\n}","preventionTips":["Only use \"private\" or \"host\" for default_pid_mode/default_ipc_mode.","Treat empty string as invalid — always set the key explicitly.","Re-check driver config against docs when upgrading Nomad versions."],"tags":["nomad","exec-driver","configuration","validation"],"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"}