{"record":{"id":"8a6c14631716f46e","repo":"wailsapp/wails","slug":"stretchblt-failed","errorCode":null,"errorMessage":"StretchBlt failed","messagePattern":"StretchBlt failed","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"v3/pkg/w32/gdi32.go","lineNumber":464,"sourceCode":"\treturn int(ret)\n}\n\nfunc StretchBlt(hdcDest HDC, nXOriginDest, nYOriginDest, nWidthDest, nHeightDest int, hdcSrc HDC, nXOriginSrc, nYOriginSrc, nWidthSrc, nHeightSrc int, dwRop uint) {\n\tret, _, _ := procStretchBlt.Call(\n\t\tuintptr(hdcDest),\n\t\tuintptr(nXOriginDest),\n\t\tuintptr(nYOriginDest),\n\t\tuintptr(nWidthDest),\n\t\tuintptr(nHeightDest),\n\t\tuintptr(hdcSrc),\n\t\tuintptr(nXOriginSrc),\n\t\tuintptr(nYOriginSrc),\n\t\tuintptr(nWidthSrc),\n\t\tuintptr(nHeightSrc),\n\t\tuintptr(dwRop))\n\n\tif ret == 0 {\n\t\tpanic(\"StretchBlt failed\")\n\t}\n}\n\nfunc SetDIBitsToDevice(hdc HDC, xDest, yDest, dwWidth, dwHeight, xSrc, ySrc int, uStartScan, cScanLines uint, lpvBits []byte, lpbmi *BITMAPINFO, fuColorUse uint) int {\n\tret, _, _ := procSetDIBitsToDevice.Call(\n\t\tuintptr(hdc),\n\t\tuintptr(xDest),\n\t\tuintptr(yDest),\n\t\tuintptr(dwWidth),\n\t\tuintptr(dwHeight),\n\t\tuintptr(xSrc),\n\t\tuintptr(ySrc),\n\t\tuintptr(uStartScan),\n\t\tuintptr(cScanLines),\n\t\tuintptr(unsafe.Pointer(&lpvBits[0])),\n\t\tuintptr(unsafe.Pointer(lpbmi)),\n\t\tuintptr(fuColorUse))\n","sourceCodeStart":446,"sourceCodeEnd":482,"githubUrl":"https://github.com/wailsapp/wails/blob/0e754b1b40ba9044c2a1460e23b7c3de20fc5cf3/v3/pkg/w32/gdi32.go#L446-L482","documentation":"Error \"StretchBlt failed\" thrown in wailsapp/wails.","triggerScenarios":"Occurs when StretchBlt returns zero, e.g. invalid source/destination DC handles, invalid raster operation, or zero/negative dimensions causing an invalid stretch.","commonSituations":"See trigger scenarios.","solutions":["Ensure both destination and source HDCs are valid and that the source DC has a bitmap selected before calling StretchBlt.","Check that source and destination rectangles are non-empty and within bounds; zero or negative dimensions cause failure.","Set a valid stretching mode with SetStretchBltMode on the destination DC before stretching when colors are combined.","Verify the raster operation (dwRop) is supported by both device contexts."],"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"}