slackhq/nebula · error

CoCreateInstance(NetworkListManager): %s

Error message

CoCreateInstance(NetworkListManager): %s

What it means

CoCreateInstance failed to instantiate the Network List Manager COM object (CLSID_NetworkListManager). createNetworkListManager calls CoCreateInstance after COM has been initialized, and any failing HRESULT is reported with this message. Without the NLM instance the library cannot enumerate networks or set the category for an adapter.

Source

Thrown at overlay/network_category_windows.go:278

			return windows.CoUninitialize, nil
		case hrRPCEChangedMode:
			return func() {}, nil
		}
	}
	return nil, fmt.Errorf("CoInitializeEx: %w", err)
}

func createNetworkListManager() (*iNetworkListManager, error) {
	var nlm *iNetworkListManager
	r1, _, _ := procCoCreateInstance.Call(
		uintptr(unsafe.Pointer(&clsidNetworkListManager)),
		0,
		uintptr(clsCtxAll),
		uintptr(unsafe.Pointer(&iidINetworkListManager)),
		uintptr(unsafe.Pointer(&nlm)),
	)
	if hr := hresult(r1); hr.failed() {
		return nil, fmt.Errorf("CoCreateInstance(NetworkListManager): %s", hr)
	}
	return nlm, nil
}

// setNetworkCategory locates the network connection bound to adapterGUID and
// sets the category of its parent network. Returns errAdapterNotFound if the
// adapter is not yet visible in the NLM enumeration.
func setNetworkCategory(adapterGUID windows.GUID, cat networkCategory) error {
	deinit, err := coInit()
	if err != nil {
		return err
	}
	defer deinit()

	nlm, err := createNetworkListManager()
	if err != nil {
		return err
	}

View on GitHub (pinned to dd8f660c0a)

Solutions

  1. Ensure coInit/CoInitializeEx ran successfully on the same thread before createNetworkListManager
  2. Read the printed HRESULT to distinguish REGDB_E_CLASSNOTREG (repair Windows/COM), E_ACCESSDENIED (permissions/policy), or E_OUTOFMEMORY
  3. Run under an account that permits access to the Network List Manager COM class; check group policy/AV restrictions
  4. Repair COM registration of the NetworkListManager class (sfc /scannow, re-register DLLs)
  5. Verify the Network List Manager (netprofm) service is running

Example fix

// before
r1, _, _ := procCoCreateInstance.Call(...) // COM never initialized on this goroutine
// after
if err := coInit(); err != nil { return err } // initialize COM first
r1, _, _ := procCoCreateInstance.Call(...)
Defensive patterns

Strategy: try-catch

Validate before calling

if runtime.GOOS != "windows" {
    return fmt.Errorf("network list manager is windows-only")
}
// ensure the Network List Manager service exists
exec.Command("sc", "query", "netprofm").Run()

Try / catch

nlm, err := createNetworkListManager()
if err != nil {
    if strings.Contains(err.Error(), "CoCreateInstance") {
        // check COM was initialized; retry after coInit or fail fast with HRESULT logged
    }
    return err
}

Prevention

When it happens

Trigger: Calling setNetworkCategory or Test_NLM_round_trip on Windows when the COM instantiation of the NLM class fails: CoInitializeEx was not called first on that thread (COM not initialized), the Network List Manager COM class is not registered (broken Windows install), class access is denied (security policy/hardened environment), or an out-of-memory condition.

Common situations: Calling NLM functions before coInit/CoInitializeEx on the thread; running under service hardening or restricted tokens that block CLSID access; Windows systems with damaged COM registration for the Network List Manager; non-Windows builds accidentally compiled (though the file is _windows.go).

Related errors


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