{"record":{"id":"c79b13ba36139208","repo":"JanDeDobbeleer/oh-my-posh","slug":"await-requestasync-w","errorCode":null,"errorMessage":"await RequestAsync: %w","messagePattern":"await RequestAsync: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/runtime/smtc_windows.go","lineNumber":257,"sourceCode":"\tvar factory unsafe.Pointer\n\thr, _, _ = procRoGetActivationFactory.Call(\n\t\tuintptr(classID),\n\t\tuintptr(unsafe.Pointer(&iidSMTCSessionManagerStatics)),\n\t\tuintptr(unsafe.Pointer(&factory)),\n\t)\n\tif hr != 0 {\n\t\treturn nil, fmt.Errorf(\"RoGetActivationFactory: 0x%08x\", hr)\n\t}\n\tdefer comRelease(factory)\n\n\tvar asyncOp unsafe.Pointer\n\tif hr := comCall(factory, staticsRequestAsync, uintptr(unsafe.Pointer(&asyncOp))); hr != 0 {\n\t\treturn nil, fmt.Errorf(\"RequestAsync: 0x%08x\", hr)\n\t}\n\tdefer comRelease(asyncOp)\n\n\tif err := awaitAsync(asyncOp); err != nil {\n\t\treturn nil, fmt.Errorf(\"await RequestAsync: %w\", err)\n\t}\n\n\tvar manager unsafe.Pointer\n\tif hr := comCall(asyncOp, asyncOpGetResults, uintptr(unsafe.Pointer(&manager))); hr != 0 {\n\t\treturn nil, fmt.Errorf(\"GetResults manager: 0x%08x\", hr)\n\t}\n\tdefer comRelease(manager)\n\n\tvar sessions unsafe.Pointer\n\tif hr := comCall(manager, managerGetSessions, uintptr(unsafe.Pointer(&sessions))); hr != 0 {\n\t\treturn nil, fmt.Errorf(\"GetSessions: 0x%08x\", hr)\n\t}\n\tdefer comRelease(sessions)\n\n\tvar size uint32\n\tif hr := comCall(sessions, vectorViewGetSize, uintptr(unsafe.Pointer(&size))); hr != 0 {\n\t\treturn nil, fmt.Errorf(\"get_Size: 0x%08x\", hr)\n\t}","sourceCodeStart":239,"sourceCodeEnd":275,"githubUrl":"https://github.com/JanDeDobbeleer/oh-my-posh/blob/0976794618c5ed95de0985dded50de1b4dc914cb/src/runtime/smtc_windows.go#L239-L275","documentation":"After RequestAsync starts, queryMediaPlayer polls the IAsyncOperation status via awaitAsync. If the operation completes as canceled/failed or times out (smtcAsyncTimeout), awaitAsync returns an error which is wrapped as \"await RequestAsync: %w\". The SMTC session list could not be retrieved in time or failed.","triggerScenarios":"awaitAsync observes asyncStatusCanceled, asyncStatusError, or the polling deadline expires while waiting for RequestAsync to complete.","commonSituations":"System under heavy load so the SMTC async op doesn't complete within the timeout; a hung audio/media service; the operation being canceled by the OS during shutdown or session changes.","solutions":["Retry the prompt render - the async operation often succeeds on a subsequent attempt.","If the error is 'async timed out', check system load / hung media services (restart audiosrv or reboot).","If 'async failed' or 'async cancelled' recurs, verify Windows media features and update Windows.","Increase smtcAsyncTimeout in smtc_windows.go if timeouts are frequent on slow machines."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Cannot pre-validate an async op; instead guard on Windows + retry hint\nif runtime.GOOS != \"windows\" { skipMediaSegment() }","typeGuard":null,"tryCatchPattern":"info, err := env.QueryMediaPlayer(player)\nif err != nil && strings.Contains(err.Error(), \"await RequestAsync\") {\n    // timed out / cancelled: retry once, else omit segment\n    info, err = env.QueryMediaPlayer(player)\n    if err != nil { return templateWithoutMedia }\n}","preventionTips":["Allow one retry for transient async timeouts before giving up","Avoid extremely high system load when using the media segment","Increase smtcAsyncTimeout on slow machines if timeouts recur"],"tags":["windows","winrt","async","timeout"],"backgroundTag":"async-operation-failed","analyzedSha":"0976794618c5ed95de0985dded50de1b4dc914cb","analyzedAt":"2026-08-31T23:41:19.708Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}