wailsapp/wails · error
CoCreateInstance failed with E_INVALIDARG
Error message
CoCreateInstance failed with E_INVALIDARG
What it means
Error "CoCreateInstance failed with E_INVALIDARG" thrown in wailsapp/wails.
Source
Thrown at v3/pkg/w32/ole32.go:64
func CoInitialize() {
procCoInitialize.Call(0)
}
func CoUninitialize() {
procCoUninitialize.Call()
}
func CoCreateInstance(clsid *syscall.GUID, dwClsContext uintptr, riid *syscall.GUID, ppv uintptr) HRESULT {
ret, _, _ := procCoCreateInstance.Call(
uintptr(unsafe.Pointer(clsid)),
0,
uintptr(dwClsContext),
uintptr(unsafe.Pointer(riid)),
uintptr(ppv))
switch uint32(ret) {
case E_INVALIDARG:
panic("CoCreateInstance failed with E_INVALIDARG")
case E_OUTOFMEMORY:
panic("CoCreateInstance failed with E_OUTOFMEMORY")
case E_UNEXPECTED:
panic("CoCreateInstance failed with E_UNEXPECTED")
}
return HRESULT(ret)
}
func CreateStreamOnHGlobal(hGlobal HGLOBAL, fDeleteOnRelease bool) *IStream {
stream := new(IStream)
ret, _, _ := procCreateStreamOnHGlobal.Call(
uintptr(hGlobal),
uintptr(BoolToBOOL(fDeleteOnRelease)),
uintptr(unsafe.Pointer(&stream)))
switch uint32(ret) {
case E_INVALIDARG:View on GitHub (pinned to 0e754b1b40)
Solutions
- Check all pointer arguments to CoCreateInstance: clsid and riid must be valid GUID pointers and ppv must be a valid output pointer; a null or malformed argument yields E_INVALIDARG.
- Use a valid class context such as CLSCTX_INPROC_SERVER or CLSCTX_LOCAL_SERVER for dwClsContext.
When it happens
Trigger: Occurs when CoCreateInstance returns E_INVALIDARG, typically due to an invalid class/interface identifier or invalid creation flags.
Common situations: See trigger scenarios.
AI-assisted analysis of wailsapp/wails@0e754b1b40 (2026-08-15).
Data as JSON: /api/errors/0861e606749b6fd5.
Report an issue: GitHub.