JanDeDobbeleer/oh-my-posh · warning
async cancelled
Error message
async cancelled
What it means
awaitAsync polls a WinRT IAsyncInfo operation for the media (SMTC) player query. When the polled status equals asyncStatusCanceled, the underlying WinRT async operation was cancelled before completing, so there is no result to read. This is reported by the OS/COM layer, not by oh-my-posh itself.
Source
Thrown at src/runtime/smtc_windows.go:208
var asyncInfo unsafe.Pointer
hr := comCall(asyncOp, iunknownQueryInterface,
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.View on GitHub (pinned to 0976794618)
Solutions
- Retry the media query on the next prompt render — this is typically transient.
- Disable the media playback (spotify/media) segment if the error recurs on your system.
- Update oh-my-posh, as SMTC COM polling handling may be improved in newer versions.
- Check that no third-party media tool is interfering with the SystemMediaTransportControls session.
Example fix
// before
info, err := readMediaProperties(...) // hard-fails segment
// after
if err != nil { return nil, nil } // render segment without media info Defensive patterns
Strategy: retry
Try / catch
info, err := readMediaProperties(...)
if err != nil {
// cancelled WinRT op: skip this render, retry next prompt
return nil, nil
} Prevention
- Never hard-fail a prompt segment on media query errors.
- Re-query each prompt render instead of caching failures.
- Update oh-my-posh regularly for SMTC robustness fixes.
When it happens
Trigger: queryMediaPlayer or readMediaProperties awaited an async WinRT operation (e.g. GetSessionManagerAsync) whose IAsyncInfo status became asyncStatusCanceled during the polling loop.
Common situations: Media session manager torn down mid-operation; system suspending media transport; COM apartment shutdown; another consumer cancelling the operation; rare race on Windows during prompt rendering.
Related errors
AI-assisted analysis of JanDeDobbeleer/oh-my-posh@0976794618 (2026-08-31).
Data as JSON: /api/errors/f667f0039b31d1c7.
Report an issue: GitHub.