{"record":{"id":"1090b88aa38578c8","repo":"JanDeDobbeleer/oh-my-posh","slug":"queryinterface-iasyncinfo-0x-08x","errorCode":null,"errorMessage":"QueryInterface IAsyncInfo: 0x%08x","messagePattern":"QueryInterface IAsyncInfo: 0x%08x","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/runtime/smtc_windows.go","lineNumber":196,"sourceCode":"\treturn ret\n}\n\nfunc comRelease(ptr unsafe.Pointer) {\n\tif ptr == nil {\n\t\treturn\n\t}\n\tcomCall(ptr, iunknownRelease)\n}\n\n// Polls instead of registering a Completed handler, to avoid implementing a COM callback object in Go.\nfunc awaitAsync(asyncOp unsafe.Pointer) error {\n\tvar asyncInfo unsafe.Pointer\n\thr := comCall(asyncOp, iunknownQueryInterface,\n\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}","sourceCodeStart":178,"sourceCodeEnd":214,"githubUrl":"https://github.com/JanDeDobbeleer/oh-my-posh/blob/0976794618c5ed95de0985dded50de1b4dc914cb/src/runtime/smtc_windows.go#L178-L214","documentation":"When awaiting a Windows Runtime async operation from the SMTC (System Media Transport Controls) media player integration, oh-my-posh first QueryInterface's the returned object for IAsyncInfo. A non-zero HRESULT here is reported as this error, meaning the async operation object did not expose the IAsyncInfo interface - so its status can never be polled and the await aborts.","triggerScenarios":"QueryMediaPlayer or readMediaProperties calling awaitAsync on a Windows version/WinRT surface where the async operation object fails to provide IAsyncInterface; corrupted COM aggregation or an unexpected object returned by the RequestAsync call.","commonSituations":"Old or stripped-down Windows builds where GlobalSystemMediaTransportControlsSessionManager behaves unusually; COM initialization issues in the calling thread; third-party shell environments interfering with WinRT activation.","solutions":["Update Windows - very old builds may not implement the expected SMTC async interfaces","Confirm the process runs on a thread where WinRT is usable (the code initializes RO_INIT_MULTITHREADED just before)","Treat the media segment as unavailable - the error already degrades the segment rather than crashing the prompt","If reproducible on a supported Windows 10/11 build, report it with the exact HRESULT code in the message"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"info, err := runtime.QueryMediaPlayer(env)\nif err != nil {\n\t// render the media segment empty / hide it instead of failing the prompt\n\treturn mediaSegment{}\n}","preventionTips":["Only enable the media segment on Windows 10 1809+","Hide/degrade the segment gracefully on any media query error","Keep Windows updated so WinRT async surfaces behave as expected","Log the HRESULT from the error message when filing bugs"],"tags":["windows","winrt","com","hresult"],"backgroundTag":"winrt-hresult-error","analyzedSha":"0976794618c5ed95de0985dded50de1b4dc914cb","analyzedAt":"2026-08-31T23:41:19.708Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}