JanDeDobbeleer/oh-my-posh · error

RequestAsync: 0x%08x

Error message

RequestAsync: 0x%08x

What it means

queryMediaPlayer calls the Windows SMTC (SystemMediaTransportControls) WinRT API via COM. After obtaining the GlobalSystemMediaTransportControlsSessionManager activation factory, it invokes the statics RequestAsync method. A non-zero HRESULT from that vtable call is wrapped as "RequestAsync: 0x%08x", meaning the async operation could not even be started.

Source

Thrown at src/runtime/smtc_windows.go:252

	if err != nil {
		return nil, err
	}
	defer classID.Close()

	var factory unsafe.Pointer
	hr, _, _ = procRoGetActivationFactory.Call(
		uintptr(classID),
		uintptr(unsafe.Pointer(&iidSMTCSessionManagerStatics)),
		uintptr(unsafe.Pointer(&factory)),
	)
	if hr != 0 {
		return nil, fmt.Errorf("RoGetActivationFactory: 0x%08x", hr)
	}
	defer comRelease(factory)

	var asyncOp unsafe.Pointer
	if hr := comCall(factory, staticsRequestAsync, uintptr(unsafe.Pointer(&asyncOp))); hr != 0 {
		return nil, fmt.Errorf("RequestAsync: 0x%08x", hr)
	}
	defer comRelease(asyncOp)

	if err := awaitAsync(asyncOp); err != nil {
		return nil, fmt.Errorf("await RequestAsync: %w", err)
	}

	var manager unsafe.Pointer
	if hr := comCall(asyncOp, asyncOpGetResults, uintptr(unsafe.Pointer(&manager))); hr != 0 {
		return nil, fmt.Errorf("GetResults manager: 0x%08x", hr)
	}
	defer comRelease(manager)

	var sessions unsafe.Pointer
	if hr := comCall(manager, managerGetSessions, uintptr(unsafe.Pointer(&sessions))); hr != 0 {
		return nil, fmt.Errorf("GetSessions: 0x%08x", hr)
	}
	defer comRelease(sessions)

View on GitHub (pinned to 0976794618)

Solutions

  1. Verify the OS is a full desktop Windows install where SMTC is available (Windows 10/11 with media features enabled).
  2. Confirm the error HRESULT code: 0x80004005 (E_FAIL) or 0x80040154 (REGDB_E_CLASSNOTREG) indicates the media control class is missing - update/repair Windows.
  3. Retry rendering the prompt after the media player starts; transient COM failures can resolve.
  4. Check for a locked/hung SMTC service (restart 'Windows Media Player Network Sharing Service' / reboot).
Defensive patterns

Strategy: try-catch

Validate before calling

// Windows only: confirm SMTC is usable before rendering the media segment
if runtime.GOOS != "windows" { skipMediaSegment() }
// hresult check helper for custom integrations
hr := invokeRequestAsync()
if hr != 0 { skipMediaSegment() }

Type guard

func mediaSegmentSupported() bool { return runtime.GOOS == "windows" }

Try / catch

info, err := env.QueryMediaPlayer(player)
if err != nil {
    // "RequestAsync: 0x%08x" - degrade gracefully, omit media info
    return templateWithoutMedia
}

Prevention

When it happens

Trigger: The COM vtable call to IGlobalSystemMediaTransportControlsSessionManagerStatics.RequestAsync returns a failing HRESULT - e.g. COM apartment issues from RoInitialize, the Windows runtime being unavailable/degraded, or the media session service not present.

Common situations: Running on stripped-down Windows installs (Server Core, LTSC without media features) or inside environments where the Windows.Media.Control WinRT type cannot activate; also when COM threading state is corrupted by prior unbalanced RoInitialize calls in the same thread.

Related errors


AI-assisted analysis of JanDeDobbeleer/oh-my-posh@0976794618 (2026-08-31). Data as JSON: /api/errors/973720c24e8ab6f3. Report an issue: GitHub.