wailsapp/wails · error

SizeofResource failed

Error message

SizeofResource failed

What it means

Error "SizeofResource failed" thrown in wailsapp/wails.

Source

Thrown at v3/pkg/w32/kernel32.go:181

	ret, _, _ := procFindResource.Call(
		uintptr(hModule),
		uintptr(unsafe.Pointer(lpName)),
		uintptr(unsafe.Pointer(lpType)))

	if ret == 0 {
		return 0, syscall.GetLastError()
	}

	return HRSRC(ret), nil
}

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),

View on GitHub (pinned to 0e754b1b40)

Solutions

  1. Pass the correct module handle (from LoadLibrary/GetModuleHandle) and a valid HRSRC returned by FindResource; SizeofResource fails when the resource does not exist.
  2. Verify the resource is compiled into the executable (check the .rc file / rsrc section) and the resource name and type match exactly.

When it happens

Trigger: Occurs when SizeofResource returns 0, e.g. the resource handle is invalid or the resource was not found in the module.

Common situations: See trigger scenarios.


AI-assisted analysis of wailsapp/wails@0e754b1b40 (2026-08-15). Data as JSON: /api/errors/642d8c177b6f4609. Report an issue: GitHub.