JanDeDobbeleer/oh-my-posh · warning
async failed
Error message
async failed
What it means
awaitAsync polls a WinRT IAsyncInfo operation and returns this error when the reported status is asyncStatusError, meaning the asynchronous COM/WinRT call backing the media player query completed but with a failure. The specific HRESULT behind the failure is not surfaced; the library only reports that the async operation failed.
Source
Thrown at src/runtime/smtc_windows.go:210
uintptr(unsafe.Pointer(&iidAsyncInfo)),
uintptr(unsafe.Pointer(&asyncInfo)),
)
if hr != 0 {
return fmt.Errorf("QueryInterface IAsyncInfo: 0x%08x", hr)
}
defer comRelease(asyncInfo)
deadline := time.Now().Add(smtcAsyncTimeout)
for {
var status uint32
comCall(asyncInfo, asyncInfoGetStatus, uintptr(unsafe.Pointer(&status)))
switch status {
case asyncStatusCompleted:
return nil
case asyncStatusCanceled:
return errors.New("async cancelled")
case asyncStatusError:
return errors.New("async failed")
}
if time.Now().After(deadline) {
return errors.New("async timed out")
}
time.Sleep(smtcAsyncPollInterval)
}
}
func queryMediaPlayer(player string) (*MediaInfo, error) {
// RoInitialize / RoUninitialize update thread-local state, so we have to
// pin the goroutine to one OS thread for the duration of this call.
goruntime.LockOSThread()
defer goruntime.UnlockOSThread()
// RO_INIT_MULTITHREADED = 1. S_FALSE (1) means already initialised on
// this thread, which is fine — we still pair with RoUninitialize.
hr, _, _ := procRoInitialize.Call(1)
if hr != 0 && hr != 1 {View on GitHub (pinned to 0976794618)
Solutions
- Retry on the next prompt render; media queries are re-issued each prompt.
- Play/launch a media app so a media session exists, if you want the segment populated.
- Disable the media segment in your theme config if it consistently fails.
- Ensure oh-my-posh runs in an interactive user session (not a service context).
Defensive patterns
Strategy: fallback
Try / catch
info, err := queryMediaPlayer(player)
if err != nil {
info = nil // render segment empty instead of erroring
} Prevention
- Disable the media segment if your environment (service/CI session) cannot access SMTC.
- Ensure oh-my-posh runs in an interactive user session.
- Treat async status errors as 'no media info' rather than rendering failures.
When it happens
Trigger: queryMediaPlayer or readMediaProperties awaited a WinRT async operation (e.g. session manager retrieval) whose IAsyncInfo GetStatus returned asyncStatusError within the polling loop.
Common situations: No media session available; GlobalSystemMediaTransportControlsSessionManager failing to initialize; restricted service session (e.g. running from a service or non-interactive session); Windows media stack glitches after driver/OS updates.
Related errors
- async cancelled
- async timed out
- RoGetActivationFactory: 0x%08x
- RequestAsync: 0x%08x
- await RequestAsync: %w
AI-assisted analysis of JanDeDobbeleer/oh-my-posh@0976794618 (2026-08-31).
Data as JSON: /api/errors/050476621fb455bb.
Report an issue: GitHub.