hashicorp/nomad · error

nil ReattachConfig cannot be converted

Error message

nil ReattachConfig cannot be converted

What it means

ReattachConfigToGoPlugin was passed a nil ReattachConfig wrapper. The converter cannot build a go-plugin reattach handle from nothing, so this guard rejects nil input immediately.

Source

Thrown at plugins/shared/structs/plugin_reattach_config.go:26

	"net"

	plugin "github.com/hashicorp/go-plugin"
)

// ReattachConfig is a wrapper around plugin.ReattachConfig to better support
// serialization
type ReattachConfig struct {
	Protocol string
	Network  string
	Addr     string
	Pid      int
}

// ReattachConfigToGoPlugin converts a ReattachConfig wrapper struct into a go
// plugin ReattachConfig struct
func ReattachConfigToGoPlugin(rc *ReattachConfig) (*plugin.ReattachConfig, error) {
	if rc == nil {
		return nil, fmt.Errorf("nil ReattachConfig cannot be converted")
	}

	plug := &plugin.ReattachConfig{
		Protocol: plugin.Protocol(rc.Protocol),
		Pid:      rc.Pid,
	}

	switch rc.Network {
	case "tcp", "tcp4", "tcp6":
		addr, err := net.ResolveTCPAddr(rc.Network, rc.Addr)
		if err != nil {
			return nil, err
		}
		plug.Addr = addr
	case "udp", "udp4", "udp6":
		addr, err := net.ResolveUDPAddr(rc.Network, rc.Addr)
		if err != nil {
			return nil, err

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Pass a populated ReattachConfig from the plugin's reattach handshake
  2. Check the caller for a lost config (e.g. missing from plugin handle) before converting
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at plugins/shared/structs/plugin_reattach_config.go:26 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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