{"record":{"id":"50643e1da521ebc0","repo":"DevToys-app/DevToys","slug":"webkitgtk-could-not-be-found-please-verify-that-t","errorCode":null,"errorMessage":"WebKitGTK could not be found. Please verify that the package 'libwebkitgtk-6.0-4' is installed on the operating system and retry.","messagePattern":"WebKitGTK could not be found\\. Please verify that the package 'libwebkitgtk-6\\.0-4' is installed on the operating system and retry\\.","errorType":"exception","errorClass":"DllNotFoundException","httpStatus":null,"severity":"critical","filePath":"src/app/dev/platforms/desktop/DevToys.Linux/Components/BlazorWebView/BlazorWebView.cs","lineNumber":200,"sourceCode":"    }\n\n    private void MessageReceived(Uri uri, string message)\n    {\n        _webViewManager?.MessageReceivedInternal(uri, message);\n    }\n\n    private WebView CreateWebView()\n    {\n        var webView = new WebView();\n\n        try\n        {\n            Guard.IsNotNull(webView\n                .WebContext); // this might be null or crash when trying to access the WebContext property.\n        }\n        catch (Exception e)\n        {\n            throw new DllNotFoundException(\n                \"WebKitGTK could not be found. Please verify that the package 'libwebkitgtk-6.0-4' is installed on the operating system and retry.\");\n        }\n\n        // Make web view transparent\n        webView.SetBackgroundColor(new RGBA { Red = 255, Blue = 0, Green = 0, Alpha = 0 });\n\n        // Initialize some basic properties of the WebView\n        Settings webViewSettings = webView.GetSettings();\n        webViewSettings.EnableDeveloperExtras = _enabledDeveloperTools;\n        webViewSettings.JavascriptCanAccessClipboard = true;\n        webViewSettings.EnableBackForwardNavigationGestures = false;\n        webViewSettings.MediaPlaybackRequiresUserGesture = false;\n        webViewSettings.HardwareAccelerationPolicy = HardwareAccelerationPolicy.Never; // https://github.com/DevToys-app/DevToys/issues/1234\n        webView.SetSettings(webViewSettings);\n\n        UserContentManager userContentManager = webView.GetUserContentManager();\n\n        // Handle messages.","sourceCodeStart":182,"sourceCodeEnd":218,"githubUrl":"https://github.com/DevToys-app/DevToys/blob/7e12df8448aa1f6aec4a8736b3e06a1c90530715/src/app/dev/platforms/desktop/DevToys.Linux/Components/BlazorWebView/BlazorWebView.cs#L182-L218","documentation":"Thrown as a DllNotFoundException by DevToys.Linux BlazorWebView.CreateWebView when accessing the WebView's WebContext throws (the Giraffe/Gtk bindings return null or crash when the native WebKitGTK library is not present). It is a translated, user-facing error that names the exact missing native package: libwebkitgtk-6.0-4. Without this native dependency the Linux BlazorWebView cannot construct a web view, so the whole UI shell fails to start.","triggerScenarios":"Running the Linux desktop build on a distribution where libwebkitgtk-6.0-4 (the WebKitGTK 6.0 / GTK4 bindings) is not installed; only the legacy libwebkit2gtk-4.x (WebKit2 GTK3) is present; the native library is present but for the wrong architecture; the library exists but a transitive dependency (gtk4, libsoup3) is missing causing WebContext access to throw.","commonSituations":"Fresh Linux/minimal-container install without GUI runtime deps; distro that ships only WebKitGTK 2.x; downstream repackaging that dropped the runtime dependency; Flatpak/Snap base missing the webkit2gtk-6.0 runtime.","solutions":["Install the native package: Debian/Ubuntu `sudo apt install libwebkitgtk-6.0-4`, Fedora `sudo dnf install webkitgtk6.0`, Arch `sudo pacman -S webkitgtk-6.0`.","Verify the install with `ldconfig -p | grep webkitgtk-6.0` or by checking the file exists under /usr/lib.","If on an older distro, upgrade to one shipping WebKitGTK 6.0 (GTK4 line), since the code targets the 6.0 API.","For packaging (deb/rpm/Flatpak), declare libwebkitgtk-6.0-4 as a runtime dependency.","Re-run the app; if it still fails, run with WEBKIT_DEBUG=1 / check stderr for the native load error."],"exampleFix":"// before — native load failure surfaces as a raw null/crash inside new WebView()\n\n// after — probe the native library before constructing the WebView and give an actionable message\nusing System.Runtime.InteropServices;\n\nif (!NativeLibrary.TryLoad(\"webkitgtk-6.0\", out _))\n{\n    throw new DllNotFoundException(\n        \"WebKitGTK could not be found. Please verify that the package \" +\n        \"'libwebkitgtk-6.0-4' is installed on the operating system and retry.\");\n}\nvar webView = new WebView();\nGuard.IsNotNull(webView.WebContext);","handlingStrategy":"try-catch","validationCode":"using System.Runtime.InteropServices;\n\nbool WebKitGtk6Available() =>\n    NativeLibrary.TryLoad(\"webkitgtk-6.0\", out _) ||\n    NativeLibrary.TryLoad(\"libwebkitgtk-6.0.so.4\", out _) ||\n    NativeLibrary.TryLoad(\"libwebkitgtk-6.0.4\", out _);\n\nif (!WebKitGtk6Available())\n{\n    // show install instructions instead of crashing during WebView construction\n    return;\n}","typeGuard":null,"tryCatchPattern":"try\n{\n    var webView = new WebView();\n    Guard.IsNotNull(webView.WebContext);\n    // ... proceed with CreateWebView body\n}\ncatch (DllNotFoundException ex) when (ex.Message.Contains(\"WebKitGTK\"))\n{\n    // surface the actionable install instruction (libwebkitgtk-6.0-4) to the user\n    throw;\n}","preventionTips":["Install libwebkitgtk-6.0-4 (Debian/Ubuntu) or webkitgtk6.0 (Fedora) before first launch.","In packages (deb/rpm/Flatpak), declare libwebkitgtk-6.0-4 as a hard runtime dependency.","Probe NativeLibrary.TryLoad(\"webkitgtk-6.0\") at startup and show install guidance instead of crashing.","Smoke-test the Linux build in a clean container so missing native deps surface in CI, not on user machines."],"tags":["csharp","linux","webkitgtk","native-dependency","blazor-webview"],"backgroundTag":null,"analyzedSha":"7e12df8448aa1f6aec4a8736b3e06a1c90530715","analyzedAt":"2026-08-13T10:27:33.924Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}