wailsapp/wails · error
LockResource failed
Error message
LockResource failed
What it means
Error "LockResource failed" thrown in wailsapp/wails.
Source
Thrown at v3/pkg/w32/kernel32.go:191
}
func SizeofResource(hModule HMODULE, hResInfo HRSRC) uint32 {
ret, _, _ := procSizeofResource.Call(
uintptr(hModule),
uintptr(hResInfo))
if ret == 0 {
panic("SizeofResource failed")
}
return uint32(ret)
}
func LockResource(hResData HGLOBAL) unsafe.Pointer {
ret, _, _ := procLockResource.Call(uintptr(hResData))
if ret == 0 {
panic("LockResource failed")
}
return unsafe.Pointer(ret)
}
func LoadResource(hModule HMODULE, hResInfo HRSRC) HGLOBAL {
ret, _, _ := procLoadResource.Call(
uintptr(hModule),
uintptr(hResInfo))
if ret == 0 {
panic("LoadResource failed")
}
return HGLOBAL(ret)
}
func GetLastError() uint32 {View on GitHub (pinned to 0e754b1b40)
Solutions
- Pass a valid HGLOBAL returned by LoadResource; LockResource fails on invalid or freed resource handles.
- Call FindResource and LoadResource successfully first; LockResource only works on a loaded resource, and a prior failure in those steps is the usual root cause.
When it happens
Trigger: Occurs when LockResource returns NULL, typically because the resource handle is invalid or the resource data could not be loaded.
Common situations: See trigger scenarios.
AI-assisted analysis of wailsapp/wails@0e754b1b40 (2026-08-15).
Data as JSON: /api/errors/9a5836f7b98968a8.
Report an issue: GitHub.