{"record":{"id":"d57ec798a66ea128","repo":"JanDeDobbeleer/oh-my-posh","slug":"not-connected","errorCode":null,"errorMessage":"not connected","messagePattern":"not connected","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/runtime/networks_windows.go","lineNumber":236,"sourceCode":"\te, _, err = hWlanEnumInterfaces.Call(uintptr(phClientHandle), uintptr(unsafe.Pointer(nil)), uintptr(unsafe.Pointer(&interfaceList)))\n\tif e != 0 {\n\t\treturn nil, err\n\t}\n\n\t// use first interface that is connected\n\tnumberOfInterfaces := int(interfaceList.dwNumberOfItems)\n\tinfoSize := unsafe.Sizeof(interfaceList.InterfaceInfo[0])\n\tfor i := range numberOfInterfaces {\n\t\tnetwork := (*WLAN_INTERFACE_INFO)(unsafe.Add(unsafe.Pointer(&interfaceList.InterfaceInfo[0]), uintptr(i)*infoSize))\n\t\tif network.isState != 1 {\n\t\t\tlog.Debug(\"Skipping non-connected wifi interface\")\n\t\t\tcontinue\n\t\t}\n\n\t\treturn term.parseNetworkInterface(network, phClientHandle)\n\t}\n\n\treturn nil, errors.New(\"not connected\")\n}\n\nfunc (term *Terminal) parseNetworkInterface(network *WLAN_INTERFACE_INFO, clientHandle uint32) (*Connection, error) {\n\tinfo := Connection{\n\t\tType: WIFI,\n\t}\n\n\t// Query wifi connection state\n\tvar dataSize uint32\n\tvar wlanAttr *WLAN_CONNECTION_ATTRIBUTES\n\te, _, err := hWlanQueryInterface.Call(uintptr(clientHandle),\n\t\tuintptr(unsafe.Pointer(&network.InterfaceGuid)),\n\t\tuintptr(7), // wlan_intf_opcode_current_connection\n\t\tuintptr(unsafe.Pointer(nil)),\n\t\tuintptr(unsafe.Pointer(&dataSize)),\n\t\tuintptr(unsafe.Pointer(&wlanAttr)),\n\t\tuintptr(unsafe.Pointer(nil)))\n\tif e != 0 {","sourceCodeStart":218,"sourceCodeEnd":254,"githubUrl":"https://github.com/JanDeDobbeleer/oh-my-posh/blob/0976794618c5ed95de0985dded50de1b4dc914cb/src/runtime/networks_windows.go#L218-L254","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Connect to a Wi-Fi network (or enable the Wi-Fi radio) if you want Wi-Fi info in the prompt.","Use a non-Wi-Fi connection type segment or configure the network segment to also show Ethernet so it renders without Wi-Fi.","Ignore/suppress the error: the segment should skip the Wi-Fi block when this error is returned.","Check the adapter is enabled: Device Manager > Network adapters, or `netsh interface show interface`."],"exampleFix":"// before: segment assumes Wi-Fi always exists\nconn, err := env.Connections()\n// after: treat \"not connected\" as empty Wi-Fi info\nif err != nil { conn = nil }","handlingStrategy":"fallback","validationCode":"// windows: check adapter state before asking for wifi info\nout, _ := exec.Command(\"netsh\", \"interface\", \"show\", \"interface\").Output()\nhasWifiUp := strings.Contains(string(out), \"Connected\") && strings.Contains(string(out), \"Wi-Fi\")","typeGuard":null,"tryCatchPattern":"conn, err := env.Connections()\nif err != nil || conn == nil {\n    conn = nil // render segment without wifi block\n}","preventionTips":["Treat wifi absence as a normal state, not a failure.","Test prompts on machines without Wi-Fi (Ethernet-only desktops, VMs).","Keep a fallback (Ethernet/VPN) connection block in your theme."],"tags":["windows","wifi","network"],"backgroundTag":"wifi-not-connected","analyzedSha":"0976794618c5ed95de0985dded50de1b4dc914cb","analyzedAt":"2026-08-31T23:41:19.708Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}