{"record":{"id":"3f559fce6a743ecb","repo":"wailsapp/wails","slug":"setbkcolor-failed","errorCode":null,"errorMessage":"SetBkColor failed","messagePattern":"SetBkColor failed","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"v3/pkg/w32/gdi32.go","lineNumber":428,"sourceCode":"func SetTextColor(hdc HDC, crColor COLORREF) COLORREF {\n\tret, _, _ := procSetTextColor.Call(\n\t\tuintptr(hdc),\n\t\tuintptr(crColor))\n\n\tif ret == CLR_INVALID {\n\t\tpanic(\"SetTextColor failed\")\n\t}\n\n\treturn COLORREF(ret)\n}\n\nfunc SetBkColor(hdc HDC, crColor COLORREF) COLORREF {\n\tret, _, _ := procSetBkColor.Call(\n\t\tuintptr(hdc),\n\t\tuintptr(crColor))\n\n\tif ret == CLR_INVALID {\n\t\tpanic(\"SetBkColor failed\")\n\t}\n\n\treturn COLORREF(ret)\n}\n\nfunc StartDoc(hdc HDC, lpdi *DOCINFO) int {\n\tret, _, _ := procStartDoc.Call(\n\t\tuintptr(hdc),\n\t\tuintptr(unsafe.Pointer(lpdi)))\n\n\treturn int(ret)\n}\n\nfunc StartPage(hdc HDC) int {\n\tret, _, _ := procStartPage.Call(\n\t\tuintptr(hdc))\n\n\treturn int(ret)","sourceCodeStart":410,"sourceCodeEnd":446,"githubUrl":"https://github.com/wailsapp/wails/blob/0e754b1b40ba9044c2a1460e23b7c3de20fc5cf3/v3/pkg/w32/gdi32.go#L410-L446","documentation":"Error \"SetBkColor failed\" thrown in wailsapp/wails.","triggerScenarios":"Occurs when SetBkColor returns CLR_INVALID, typically due to an invalid device context handle or an invalid color value.","commonSituations":"See trigger scenarios.","solutions":["Pass a valid HDC that supports text output; SetBkColor fails on invalid or deleted device contexts.","Ensure the COLORREF value is a valid RGB value created with the RGB macro; an invalid color value causes the call to return CLR_INVALID."],"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"}