wailsapp/wails · error
PatBlt failed
Error message
PatBlt failed
What it means
Error "PatBlt failed" thrown in wailsapp/wails.
Source
Thrown at v3/pkg/w32/gdi32.go:128
uintptr(nYSrc),
uintptr(dwRop))
if ret == 0 {
panic("BitBlt failed")
}
}
func PatBlt(hdc HDC, nXLeft, nYLeft, nWidth, nHeight int, dwRop uint) {
ret, _, _ := procPatBlt.Call(
uintptr(hdc),
uintptr(nXLeft),
uintptr(nYLeft),
uintptr(nWidth),
uintptr(nHeight),
uintptr(dwRop))
if ret == 0 {
panic("PatBlt failed")
}
}
func CloseEnhMetaFile(hdc HDC) HENHMETAFILE {
ret, _, _ := procCloseEnhMetaFile.Call(
uintptr(hdc))
return HENHMETAFILE(ret)
}
func CopyEnhMetaFile(hemfSrc HENHMETAFILE, lpszFile *uint16) HENHMETAFILE {
ret, _, _ := procCopyEnhMetaFile.Call(
uintptr(hemfSrc),
uintptr(unsafe.Pointer(lpszFile)))
return HENHMETAFILE(ret)
}
View on GitHub (pinned to 0e754b1b40)
Solutions
- Ensure the HDC passed to PatBlt is valid and not already released; the device context must be a memory DC or window DC that supports raster operations.
- Verify the raster operation code (dwRop) is a supported ternary raster operation such as PATCOPY, BLACKNESS, or WHITENESS.
- Check that the region (nXLeft, nYLeft, nWidth, nHeight) lies within the DC's clipping region and that no prior drawing call left the DC in an error state.
When it happens
Trigger: Occurs when the Win32 PatBlt GDI call returns zero, e.g. an invalid device context handle, invalid raster operation code, or coordinates outside the DC bounds during bitmap filling.
Common situations: See trigger scenarios.
AI-assisted analysis of wailsapp/wails@0e754b1b40 (2026-08-15).
Data as JSON: /api/errors/3de78d0dd1359a54.
Report an issue: GitHub.