hashicorp/nomad · error

Plugin.ConnectionInfo must not be nil

Error message

Plugin.ConnectionInfo must not be nil

What it means

RegisterPlugin requires ConnectionInfo (e.g. the plugin's socket path and mode) because callers need connection details to reach the plugin. A nil ConnectionInfo returns this defensive, development-aid error before registration persists.

Source

Thrown at client/dynamicplugins/registry.go:180

	// setup stubs
	if d.stubDispensers == nil {
		d.stubDispensers = make(map[string]PluginDispenser, 1)
	}

	d.stubDispensers[ptype] = dispenser
}

func (d *dynamicRegistry) RegisterPlugin(info *PluginInfo) error {
	if info.Type == "" {
		// This error shouldn't make it to a production cluster and is to aid
		// developers during the development of new plugin types.
		return errors.New("Plugin.Type must not be empty")
	}

	if info.ConnectionInfo == nil {
		// This error shouldn't make it to a production cluster and is to aid
		// developers during the development of new plugin types.
		return errors.New("Plugin.ConnectionInfo must not be nil")
	}

	if info.Name == "" {
		// This error shouldn't make it to a production cluster and is to aid
		// developers during the development of new plugin types.
		return errors.New("Plugin.Name must not be empty")
	}

	d.pluginsLock.Lock()
	defer d.pluginsLock.Unlock()

	pmap, ok := d.plugins[info.Type]
	if !ok {
		pmap = make(map[string]*list.List)
		d.plugins[info.Type] = pmap
	}
	infos, ok := pmap[info.Name]
	if !ok {

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Set ConnectionInfo to &dynamicplugins.PluginConnectionInfo{SocketPath: path, Mode: mode} before registering
  2. Ensure the CSI plugin's socket path is resolved from its alloc/network advertise before registering
  3. Run info.Validate() prior to RegisterPlugin to surface all invalid fields

Example fix

// before
info := &dynamicplugins.PluginInfo{Name: name, Type: "csi-node"}
registry.RegisterPlugin(info) // error: Plugin.ConnectionInfo must not be nil
// after
info := &dynamicplugins.PluginInfo{Name: name, Type: "csi-node",
    ConnectionInfo: &dynamicplugins.PluginConnectionInfo{SocketPath: socketPath, Mode: dynamicplugins.ConnectionModeUnix}}
return registry.RegisterPlugin(info)
Defensive patterns

Strategy: validation

Validate before calling

if info == nil || info.ConnectionInfo == nil || info.ConnectionInfo.SocketPath == "" {
    return errors.New("plugin connection info (socket path) is required")
}
if err := info.Validate(); err != nil { return err }

Type guard

func registrable(info *dynamicplugins.PluginInfo) bool {
    return info != nil && info.Type != "" && info.ConnectionInfo != nil && info.Name != ""
}

Try / catch

if err := registry.RegisterPlugin(info); err != nil {
    if err.Error() == "Plugin.ConnectionInfo must not be nil" {
        return fmt.Errorf("plugin %q has no connection info; socket discovery failed", info.Name)
    }
    return err
}

Prevention

When it happens

Trigger: Calling RegisterPlugin with a PluginInfo whose ConnectionInfo is nil — typically when constructing PluginInfo manually or when the CSI plugin's socket information was not captured at registration.

Common situations: Hand-rolled PluginInfo in tests; CSI registration where the socket path discovery failed but registration proceeded; upgrading Nomad and replaying old registry snapshots lacking connection info.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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