slackhq/nebula · error

INetworkConnection.GetAdapterId: %s

Error message

INetworkConnection.GetAdapterId: %s

What it means

This error wraps a failed HRESULT from INetworkConnection::GetAdapterId, a COM call used during Windows network category detection to correlate a network connection with its adapter GUID. A failing HRESULT means the NLM COM object refused or failed the call (service unavailable, stale connection pointer, or permission problem).

Source

Thrown at overlay/network_category_windows.go:188

	GetConnectivity       uintptr
	GetConnectionId       uintptr
	GetAdapterId          uintptr
	GetDomainType         uintptr
}

type iNetworkConnection struct{ Vtbl *iNetworkConnectionVtbl }

func (c *iNetworkConnection) Release() {
	syscall.SyscallN(c.Vtbl.Release, uintptr(unsafe.Pointer(c)))
}

func (c *iNetworkConnection) GetAdapterId() (windows.GUID, error) {
	var g windows.GUID
	r1, _, _ := syscall.SyscallN(c.Vtbl.GetAdapterId,
		uintptr(unsafe.Pointer(c)), uintptr(unsafe.Pointer(&g)),
	)
	if hr := hresult(r1); hr.failed() {
		return windows.GUID{}, fmt.Errorf("INetworkConnection.GetAdapterId: %s", hr)
	}
	return g, nil
}

func (c *iNetworkConnection) GetNetwork() (*iNetwork, error) {
	var net *iNetwork
	r1, _, _ := syscall.SyscallN(c.Vtbl.GetNetwork,
		uintptr(unsafe.Pointer(c)), uintptr(unsafe.Pointer(&net)),
	)
	if hr := hresult(r1); hr.failed() {
		return nil, fmt.Errorf("INetworkConnection.GetNetwork: %s", hr)
	}
	return net, nil
}

type iNetworkVtbl struct {
	iDispatchVtbl
	GetName                    uintptr

View on GitHub (pinned to dd8f660c0a)

Solutions

  1. Re-enumerate network connections to get fresh iNetworkConnection pointers, then retry GetAdapterId
  2. Verify the Network List Service (netprofm) is healthy and running
  3. Ensure the COM call runs in the same apartment/thread where the object was created
  4. Inspect the hresult in the message for the exact COM error (e.g. RPC_E_DISCONNECTED) and handle stale-object cases by refreshing the enumeration

Example fix

// before
adapterId, err := conn.GetAdapterId()
if err != nil { return err }
// after: refresh stale connections once
adapterId, err := conn.GetAdapterId()
if err != nil {
    if refreshed, rerr := refreshConnections(); rerr == nil {
        adapterId, err = refreshed.GetAdapterId()
    }
    if err != nil { return err }
}
Defensive patterns

Strategy: retry

Validate before calling

// ensure the connection pointer is fresh before querying
if connsStaleAt.After(netProfileChangedAt) {
    conns, err = nlm.GetNetworkConnections() // re-enumerate
    if err != nil { return err }
}

Type guard

func isAdapterIdError(err error) bool {
    return err != nil && strings.HasPrefix(err.Error(), "INetworkConnection.GetAdapterId:")
}

Try / catch

var adapterId windows.GUID
var err error
for i := 0; i < 2; i++ {
    adapterId, err = conn.GetAdapterId()
    if err == nil { break }
    if conn, err = refreshConnection(); err != nil { break }
}
if err != nil { log.Warnf("adapter id lookup failed: %v", err) }

Prevention

When it happens

Trigger: Calling GetAdapterId() on an iNetworkConnection pointer obtained from the enumerator while classifying the tunnel adapter's network, when the COM vtbl call returns a failed HRESULT.

Common situations: The connection object became stale after a network change (adapter removed, VPN adapter recreated); NLM service instability; running in restricted service contexts where NLM queries are denied.

Related errors


AI-assisted analysis of slackhq/nebula@dd8f660c0a (2026-09-03). Data as JSON: /api/errors/b5996b134f27b12c. Report an issue: GitHub.