hashicorp/nomad · error
Plugin.Name must not be empty
Error message
Plugin.Name must not be empty
What it means
RegisterPlugin validates the PluginInfo struct before storing it in the dynamic plugin registry. An empty Name field means the plugin registration lacks a unique identifier, so the registry rejects it. The in-code comment notes this error is meant to aid developers creating new plugin types, not to appear in production clusters.
Source
Thrown at client/dynamicplugins/registry.go:186
}
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 {
infos = list.New()
pmap[info.Name] = infos
}
// TODO(tgross): https://github.com/hashicorp/nomad/issues/11786
// If we're already registered, we should update the definitionView on GitHub (pinned to 482b49bf1a)
Solutions
- Set the Name field on the dynamicplugins.PluginInfo before calling RegisterPlugin
- Derive the name from the plugin's config/ID and validate it is non-empty at construction
- Add a unit test for the registration handler that asserts Name is populated
Example fix
// before
info := &dynamicplugins.PluginInfo{Type: dynamicplugins.PluginTypeCSIDriver, ConnectionInfo: connInfo}
err := registry.RegisterPlugin(info)
// after
info := &dynamicplugins.PluginInfo{Type: dynamicplugins.PluginTypeCSIDriver, Name: driverName, ConnectionInfo: connInfo}
if info.Name == "" {
return fmt.Errorf("plugin name is required")
}
err := registry.RegisterPlugin(info) Defensive patterns
Strategy: validation
Validate before calling
if info == nil || info.Name == "" {
return fmt.Errorf("cannot register plugin of type %s: name is required", info.Type)
}
err := registry.RegisterPlugin(info) Type guard
func validPluginInfo(info *dynamicplugins.PluginInfo) bool {
return info != nil && info.Name != "" && info.Type != "" && info.ConnectionInfo != nil
} Prevention
- Always populate PluginInfo.Name from a validated config value at construction time
- Add constructor helpers that reject empty names before building PluginInfo
- Write registration-handler unit tests asserting non-empty Name
When it happens
Trigger: Calling client dynamicplugins Registry.RegisterPlugin with a *dynamicplugins.PluginInfo whose Name field is the empty string (typically constructed programmatically by a new plugin type registration handler).
Common situations: Developing a new dynamic plugin type (e.g. CSI or host volume plugin) where the registration handler forgets to set PluginInfo.Name, or builds it from a config value that is empty.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- must specify plugin type to deregister
- must specify plugin name to deregister
- must specify plugin allocation ID to deregister
- must specify plugin type to dispense
- must specify plugin name to dispense
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/b1e3cbeea38cfec0.
Report an issue: GitHub.