{"record":{"id":"c9c2e4f12219a9d8","repo":"wailsapp/wails","slug":"globallock-failed","errorCode":null,"errorMessage":"GlobalLock failed","messagePattern":"GlobalLock failed","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"v3/pkg/w32/kernel32.go","lineNumber":143,"sourceCode":"\t\tpanic(\"GlobalAlloc failed\")\n\t}\n\n\treturn HGLOBAL(ret)\n}\n\nfunc GlobalFree(hMem HGLOBAL) {\n\tret, _, _ := procGlobalFree.Call(uintptr(hMem))\n\n\tif ret != 0 {\n\t\tpanic(\"GlobalFree failed\")\n\t}\n}\n\nfunc GlobalLock(hMem HGLOBAL) unsafe.Pointer {\n\tret, _, _ := procGlobalLock.Call(uintptr(hMem))\n\n\tif ret == 0 {\n\t\tpanic(\"GlobalLock failed\")\n\t}\n\n\treturn unsafe.Pointer(ret)\n}\n\nfunc GlobalUnlock(hMem HGLOBAL) bool {\n\tret, _, _ := procGlobalUnlock.Call(uintptr(hMem))\n\n\treturn ret != 0\n}\n\nfunc MoveMemory(destination, source unsafe.Pointer, length uint32) {\n\tprocMoveMemory.Call(\n\t\tuintptr(unsafe.Pointer(destination)),\n\t\tuintptr(source),\n\t\tuintptr(length))\n}\n","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/wailsapp/wails/blob/0e754b1b40ba9044c2a1460e23b7c3de20fc5cf3/v3/pkg/w32/kernel32.go#L125-L161","documentation":"Error \"GlobalLock failed\" thrown in wailsapp/wails.","triggerScenarios":"Occurs when GlobalLock returns NULL, e.g. the global memory handle is invalid, discarded, or the memory object has been freed.","commonSituations":"See trigger scenarios.","solutions":["Ensure the HGLOBAL passed to GlobalLock is a valid handle allocated with GlobalAlloc using GMEM_MOVEABLE.","Do not lock a handle that has already been freed or discarded; check the handle before locking.","Check for system memory exhaustion, which can also make GlobalLock fail."],"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-15T22:17:37.221Z"}