{"record":{"id":"ffdd70213a4b2560","repo":"JanDeDobbeleer/oh-my-posh","slug":"async-timed-out","errorCode":null,"errorMessage":"async timed out","messagePattern":"async timed out","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/runtime/smtc_windows.go","lineNumber":213,"sourceCode":"\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 {\n\t\treturn nil, fmt.Errorf(\"RoInitialize: 0x%08x\", hr)\n\t}\n\tdefer func() { _, _, _ = procRoUninitialize.Call() }()","sourceCodeStart":195,"sourceCodeEnd":231,"githubUrl":"https://github.com/JanDeDobbeleer/oh-my-posh/blob/0976794618c5ed95de0985dded50de1b4dc914cb/src/runtime/smtc_windows.go#L195-L231","documentation":"awaitAsync polls the WinRT async operation status on a fixed interval until a deadline (smtcAsyncTimeout) expires. If the operation neither completes, nor is cancelled, nor errors before the deadline, the library stops waiting and returns this timeout error rather than blocking prompt rendering indefinitely.","triggerScenarios":"queryMediaPlayer or readMediaProperties awaited an async WinRT operation that stayed in a non-terminal state (e.g. Started) longer than smtcAsyncTimeout, causing the polling loop to pass its deadline.","commonSituations":"Slow or heavily loaded system delaying COM callbacks; Windows media service unresponsive; system resuming from sleep with media stack still initializing; antivirus or COM contention slowing the call.","solutions":["Retry on the next prompt render — usually a transient delay.","Disable the media/spotify segment if timeouts happen frequently on your machine.","Close unresponsive media apps or restart Windows Audio/SMTC-related services.","Update oh-my-posh in case the timeout budget or polling strategy was adjusted."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"info, err := queryMediaPlayer(player)\nif errors.Is(err, errTimeoutLike) || err != nil {\n    // skip this render; the next prompt retries the query\n    return nil, nil\n}","preventionTips":["Keep the media segment asynchronous/tolerant — never block prompt rendering.","Avoid running prompts on heavily loaded or just-resumed systems without expecting occasional timeouts.","Restart unresponsive media/Windows audio services if timeouts recur."],"tags":["windows","winrt","media","timeout"],"backgroundTag":"async-operation-timeout","analyzedSha":"0976794618c5ed95de0985dded50de1b4dc914cb","analyzedAt":"2026-08-31T23:41:19.708Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}