hashicorp/nomad · error

ipc_mode must be %q or %q, got %q

Error message

ipc_mode must be %q or %q, got %q

What it means

TaskConfig.validate() rejects a task whose ModeIPC (ipc_mode) is not "", "private", or "host". Like pid_mode, an unset value inherits the driver default; unsupported values mean the executor cannot construct the IPC namespace, so validation fails.

Source

Thrown at drivers/exec/driver.go:229

	// CapDrop is a set of linux capabilities to disable.
	CapDrop []string `codec:"cap_drop"`

	// WorkDir is the working directory inside the chroot
	WorkDir string `codec:"work_dir"`
}

func (tc *TaskConfig) validate() error {
	switch tc.ModePID {
	case "", executor.IsolationModePrivate, executor.IsolationModeHost:
	default:
		return fmt.Errorf("pid_mode must be %q or %q, got %q", executor.IsolationModePrivate, executor.IsolationModeHost, tc.ModePID)
	}

	switch tc.ModeIPC {
	case "", executor.IsolationModePrivate, executor.IsolationModeHost:
	default:
		return fmt.Errorf("ipc_mode must be %q or %q, got %q", executor.IsolationModePrivate, executor.IsolationModeHost, tc.ModeIPC)
	}

	supported := capabilities.Supported()
	badAdds := supported.Difference(capabilities.New(tc.CapAdd))
	if !badAdds.Empty() {
		return fmt.Errorf("cap_add configured with capabilities not supported by system: %s", badAdds)
	}

	badDrops := supported.Difference(capabilities.New(tc.CapDrop))
	if !badDrops.Empty() {
		return fmt.Errorf("cap_drop configured with capabilities not supported by system: %s", badDrops)
	}

	if tc.WorkDir != "" && !filepath.IsAbs(tc.WorkDir) {
		return fmt.Errorf("work_dir must be absolute but got relative path %q", tc.WorkDir)
	}

	return nil

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Set ipc_mode to "private" or "host" or remove it
  2. Remove Docker-only IPC modes
  3. Correct lowercase spelling

Example fix

// before
config {
  ipc_mode = "shareable"
}
// after
config {
  ipc_mode = "host"
}
Defensive patterns

Strategy: validation

Validate before calling

if !(tc.ModeIPC == "" || tc.ModeIPC == "private" || tc.ModeIPC == "host") {
  return fmt.Errorf("invalid ipc_mode %q", tc.ModeIPC)
}

Type guard

func validIpcMode(v string) bool {
  return v == "" || v == "private" || v == "host"
}

Try / catch

if err := task.Validate(); err != nil {
  if strings.Contains(err.Error(), "ipc_mode") {
    cfg.ModeIPC = ""
  }
  return err
}

Prevention

When it happens

Trigger: Job submission with task config ipc_mode set to something other than "private", "host", or "" (Docker-style "shareable", "container:<id>", case mistakes, typos).

Common situations: Migrating Docker jobs to exec; using ipc_mode = "shareable" from Docker conventions; HCL typos.

Related errors


AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04). Data as JSON: /api/errors/c57e55b4ad4e49b6. Report an issue: GitHub.