{"record":{"id":"1c152ad3abe9542d","repo":"hashicorp/nomad","slug":"plugin-connectioninfo-must-not-be-nil","errorCode":null,"errorMessage":"Plugin.ConnectionInfo must not be nil","messagePattern":"Plugin\\.ConnectionInfo must not be nil","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/dynamicplugins/registry.go","lineNumber":180,"sourceCode":"\t// setup stubs\n\tif d.stubDispensers == nil {\n\t\td.stubDispensers = make(map[string]PluginDispenser, 1)\n\t}\n\n\td.stubDispensers[ptype] = dispenser\n}\n\nfunc (d *dynamicRegistry) RegisterPlugin(info *PluginInfo) error {\n\tif info.Type == \"\" {\n\t\t// This error shouldn't make it to a production cluster and is to aid\n\t\t// developers during the development of new plugin types.\n\t\treturn errors.New(\"Plugin.Type must not be empty\")\n\t}\n\n\tif info.ConnectionInfo == nil {\n\t\t// This error shouldn't make it to a production cluster and is to aid\n\t\t// developers during the development of new plugin types.\n\t\treturn errors.New(\"Plugin.ConnectionInfo must not be nil\")\n\t}\n\n\tif info.Name == \"\" {\n\t\t// This error shouldn't make it to a production cluster and is to aid\n\t\t// developers during the development of new plugin types.\n\t\treturn errors.New(\"Plugin.Name must not be empty\")\n\t}\n\n\td.pluginsLock.Lock()\n\tdefer d.pluginsLock.Unlock()\n\n\tpmap, ok := d.plugins[info.Type]\n\tif !ok {\n\t\tpmap = make(map[string]*list.List)\n\t\td.plugins[info.Type] = pmap\n\t}\n\tinfos, ok := pmap[info.Name]\n\tif !ok {","sourceCodeStart":162,"sourceCodeEnd":198,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/client/dynamicplugins/registry.go#L162-L198","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Set ConnectionInfo to &dynamicplugins.PluginConnectionInfo{SocketPath: path, Mode: mode} before registering","Ensure the CSI plugin's socket path is resolved from its alloc/network advertise before registering","Run info.Validate() prior to RegisterPlugin to surface all invalid fields"],"exampleFix":"// before\ninfo := &dynamicplugins.PluginInfo{Name: name, Type: \"csi-node\"}\nregistry.RegisterPlugin(info) // error: Plugin.ConnectionInfo must not be nil\n// after\ninfo := &dynamicplugins.PluginInfo{Name: name, Type: \"csi-node\",\n    ConnectionInfo: &dynamicplugins.PluginConnectionInfo{SocketPath: socketPath, Mode: dynamicplugins.ConnectionModeUnix}}\nreturn registry.RegisterPlugin(info)","handlingStrategy":"validation","validationCode":"if info == nil || info.ConnectionInfo == nil || info.ConnectionInfo.SocketPath == \"\" {\n    return errors.New(\"plugin connection info (socket path) is required\")\n}\nif err := info.Validate(); err != nil { return err }","typeGuard":"func registrable(info *dynamicplugins.PluginInfo) bool {\n    return info != nil && info.Type != \"\" && info.ConnectionInfo != nil && info.Name != \"\"\n}","tryCatchPattern":"if err := registry.RegisterPlugin(info); err != nil {\n    if err.Error() == \"Plugin.ConnectionInfo must not be nil\" {\n        return fmt.Errorf(\"plugin %q has no connection info; socket discovery failed\", info.Name)\n    }\n    return err\n}","preventionTips":["Resolve the plugin's socket path (from its alloc network/advertise) before registration","Verify the socket file exists before building ConnectionInfo","Call info.Validate() first to catch all field issues in one pass"],"tags":["dynamic-plugins","validation","nomad","csi"],"backgroundTag":"missing-required-argument","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"}