{"record":{"id":"050476621fb455bb","repo":"JanDeDobbeleer/oh-my-posh","slug":"async-failed","errorCode":null,"errorMessage":"async failed","messagePattern":"async failed","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/runtime/smtc_windows.go","lineNumber":210,"sourceCode":"\t\tuintptr(unsafe.Pointer(&iidAsyncInfo)),\n\t\tuintptr(unsafe.Pointer(&asyncInfo)),\n\t)\n\tif hr != 0 {\n\t\treturn fmt.Errorf(\"QueryInterface IAsyncInfo: 0x%08x\", hr)\n\t}\n\tdefer comRelease(asyncInfo)\n\n\tdeadline := time.Now().Add(smtcAsyncTimeout)\n\tfor {\n\t\tvar status uint32\n\t\tcomCall(asyncInfo, asyncInfoGetStatus, uintptr(unsafe.Pointer(&status)))\n\t\tswitch status {\n\t\tcase asyncStatusCompleted:\n\t\t\treturn nil\n\t\tcase asyncStatusCanceled:\n\t\t\treturn errors.New(\"async cancelled\")\n\t\tcase asyncStatusError:\n\t\t\treturn errors.New(\"async failed\")\n\t\t}\n\t\tif time.Now().After(deadline) {\n\t\t\treturn errors.New(\"async timed out\")\n\t\t}\n\t\ttime.Sleep(smtcAsyncPollInterval)\n\t}\n}\n\nfunc queryMediaPlayer(player string) (*MediaInfo, error) {\n\t// RoInitialize / RoUninitialize update thread-local state, so we have to\n\t// pin the goroutine to one OS thread for the duration of this call.\n\tgoruntime.LockOSThread()\n\tdefer goruntime.UnlockOSThread()\n\n\t// RO_INIT_MULTITHREADED = 1. S_FALSE (1) means already initialised on\n\t// this thread, which is fine — we still pair with RoUninitialize.\n\thr, _, _ := procRoInitialize.Call(1)\n\tif hr != 0 && hr != 1 {","sourceCodeStart":192,"sourceCodeEnd":228,"githubUrl":"https://github.com/JanDeDobbeleer/oh-my-posh/blob/0976794618c5ed95de0985dded50de1b4dc914cb/src/runtime/smtc_windows.go#L192-L228","documentation":"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.","triggerScenarios":"queryMediaPlayer or readMediaProperties awaited a WinRT async operation (e.g. session manager retrieval) whose IAsyncInfo GetStatus returned asyncStatusError within the polling loop.","commonSituations":"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.","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)."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"info, err := queryMediaPlayer(player)\nif err != nil {\n    info = nil // render segment empty instead of erroring\n}","preventionTips":["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."],"tags":["windows","winrt","media","async"],"backgroundTag":"async-operation-failed","analyzedSha":"0976794618c5ed95de0985dded50de1b4dc914cb","analyzedAt":"2026-08-31T23:41:19.708Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}