{"record":{"id":"d405302aa5141880","repo":"wailsapp/wails","slug":"cocreateinstance-failed-with-e-outofmemory","errorCode":null,"errorMessage":"CoCreateInstance failed with E_OUTOFMEMORY","messagePattern":"CoCreateInstance failed with E_OUTOFMEMORY","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"v3/pkg/w32/ole32.go","lineNumber":66,"sourceCode":"}\n\nfunc CoUninitialize() {\n\tprocCoUninitialize.Call()\n}\n\nfunc CoCreateInstance(clsid *syscall.GUID, dwClsContext uintptr, riid *syscall.GUID, ppv uintptr) HRESULT {\n\tret, _, _ := procCoCreateInstance.Call(\n\t\tuintptr(unsafe.Pointer(clsid)),\n\t\t0,\n\t\tuintptr(dwClsContext),\n\t\tuintptr(unsafe.Pointer(riid)),\n\t\tuintptr(ppv))\n\n\tswitch uint32(ret) {\n\tcase E_INVALIDARG:\n\t\tpanic(\"CoCreateInstance failed with E_INVALIDARG\")\n\tcase E_OUTOFMEMORY:\n\t\tpanic(\"CoCreateInstance failed with E_OUTOFMEMORY\")\n\tcase E_UNEXPECTED:\n\t\tpanic(\"CoCreateInstance failed with E_UNEXPECTED\")\n\t}\n\n\treturn HRESULT(ret)\n}\n\nfunc CreateStreamOnHGlobal(hGlobal HGLOBAL, fDeleteOnRelease bool) *IStream {\n\tstream := new(IStream)\n\tret, _, _ := procCreateStreamOnHGlobal.Call(\n\t\tuintptr(hGlobal),\n\t\tuintptr(BoolToBOOL(fDeleteOnRelease)),\n\t\tuintptr(unsafe.Pointer(&stream)))\n\n\tswitch uint32(ret) {\n\tcase E_INVALIDARG:\n\t\tpanic(\"CreateStreamOnHGlobal failed with E_INVALIDARG\")\n\tcase E_OUTOFMEMORY:","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/wailsapp/wails/blob/0e754b1b40ba9044c2a1460e23b7c3de20fc5cf3/v3/pkg/w32/ole32.go#L48-L84","documentation":"Error \"CoCreateInstance failed with E_OUTOFMEMORY\" thrown in wailsapp/wails.","triggerScenarios":"Occurs when CoCreateInstance returns E_OUTOFMEMORY, indicating insufficient memory to create the COM object instance.","commonSituations":"See trigger scenarios.","solutions":["Reduce process memory usage before creating the COM object; E_OUTOFMEMORY means the object could not be allocated.","Free unused COM objects and release interfaces before retrying."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0e754b1b40ba9044c2a1460e23b7c3de20fc5cf3","analyzedAt":"2026-08-15T14:17:36.034Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}