JanDeDobbeleer/oh-my-posh · warning

not connected

Error message

not connected

What it means

wifiNetwork opens the native WLAN API handle and enumerates all WLAN interfaces on the machine, looking for the first one whose state is connected (isState == 1). If every enumerated interface is disconnected (or there are no WLAN interfaces at all), the function gives up and returns this error. It is a normal, expected condition when the machine has no active Wi-Fi connection, not a bug.

Source

Thrown at src/runtime/networks_windows.go:236

	e, _, err = hWlanEnumInterfaces.Call(uintptr(phClientHandle), uintptr(unsafe.Pointer(nil)), uintptr(unsafe.Pointer(&interfaceList)))
	if e != 0 {
		return nil, err
	}

	// use first interface that is connected
	numberOfInterfaces := int(interfaceList.dwNumberOfItems)
	infoSize := unsafe.Sizeof(interfaceList.InterfaceInfo[0])
	for i := range numberOfInterfaces {
		network := (*WLAN_INTERFACE_INFO)(unsafe.Add(unsafe.Pointer(&interfaceList.InterfaceInfo[0]), uintptr(i)*infoSize))
		if network.isState != 1 {
			log.Debug("Skipping non-connected wifi interface")
			continue
		}

		return term.parseNetworkInterface(network, phClientHandle)
	}

	return nil, errors.New("not connected")
}

func (term *Terminal) parseNetworkInterface(network *WLAN_INTERFACE_INFO, clientHandle uint32) (*Connection, error) {
	info := Connection{
		Type: WIFI,
	}

	// Query wifi connection state
	var dataSize uint32
	var wlanAttr *WLAN_CONNECTION_ATTRIBUTES
	e, _, err := hWlanQueryInterface.Call(uintptr(clientHandle),
		uintptr(unsafe.Pointer(&network.InterfaceGuid)),
		uintptr(7), // wlan_intf_opcode_current_connection
		uintptr(unsafe.Pointer(nil)),
		uintptr(unsafe.Pointer(&dataSize)),
		uintptr(unsafe.Pointer(&wlanAttr)),
		uintptr(unsafe.Pointer(nil)))
	if e != 0 {

View on GitHub (pinned to 0976794618)

Solutions

  1. Connect to a Wi-Fi network (or enable the Wi-Fi radio) if you want Wi-Fi info in the prompt.
  2. Use a non-Wi-Fi connection type segment or configure the network segment to also show Ethernet so it renders without Wi-Fi.
  3. Ignore/suppress the error: the segment should skip the Wi-Fi block when this error is returned.
  4. Check the adapter is enabled: Device Manager > Network adapters, or `netsh interface show interface`.

Example fix

// before: segment assumes Wi-Fi always exists
conn, err := env.Connections()
// after: treat "not connected" as empty Wi-Fi info
if err != nil { conn = nil }
Defensive patterns

Strategy: fallback

Validate before calling

// windows: check adapter state before asking for wifi info
out, _ := exec.Command("netsh", "interface", "show", "interface").Output()
hasWifiUp := strings.Contains(string(out), "Connected") && strings.Contains(string(out), "Wi-Fi")

Try / catch

conn, err := env.Connections()
if err != nil || conn == nil {
    conn = nil // render segment without wifi block
}

Prevention

When it happens

Trigger: Calling the network/connection segment logic (getConnections -> wifiNetwork) on Windows when all WLAN interfaces report isState != 1 (interface_media_disconnected/not_connected), or when the system has zero WLAN interfaces.

Common situations: Desktop or laptop using Ethernet only; Wi-Fi turned off in Windows or via airplane mode; desktop with no wireless adapter; VM with no Wi-Fi passthrough; Wi-Fi adapter disabled in Device Manager.

Related errors


AI-assisted analysis of JanDeDobbeleer/oh-my-posh@0976794618 (2026-08-31). Data as JSON: /api/errors/d57ec798a66ea128. Report an issue: GitHub.