DevToys-app/DevToys · critical · DllNotFoundException
WebKitGTK could not be found. Please verify that the package
Error message
WebKitGTK could not be found. Please verify that the package 'libwebkitgtk-6.0-4' is installed on the operating system and retry.
What it means
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.
Source
Thrown at src/app/dev/platforms/desktop/DevToys.Linux/Components/BlazorWebView/BlazorWebView.cs:200
}
private void MessageReceived(Uri uri, string message)
{
_webViewManager?.MessageReceivedInternal(uri, message);
}
private WebView CreateWebView()
{
var webView = new WebView();
try
{
Guard.IsNotNull(webView
.WebContext); // this might be null or crash when trying to access the WebContext property.
}
catch (Exception e)
{
throw new DllNotFoundException(
"WebKitGTK could not be found. Please verify that the package 'libwebkitgtk-6.0-4' is installed on the operating system and retry.");
}
// Make web view transparent
webView.SetBackgroundColor(new RGBA { Red = 255, Blue = 0, Green = 0, Alpha = 0 });
// Initialize some basic properties of the WebView
Settings webViewSettings = webView.GetSettings();
webViewSettings.EnableDeveloperExtras = _enabledDeveloperTools;
webViewSettings.JavascriptCanAccessClipboard = true;
webViewSettings.EnableBackForwardNavigationGestures = false;
webViewSettings.MediaPlaybackRequiresUserGesture = false;
webViewSettings.HardwareAccelerationPolicy = HardwareAccelerationPolicy.Never; // https://github.com/DevToys-app/DevToys/issues/1234
webView.SetSettings(webViewSettings);
UserContentManager userContentManager = webView.GetUserContentManager();
// Handle messages.View on GitHub (pinned to 7e12df8448)
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.
Example fix
// before — native load failure surfaces as a raw null/crash inside new WebView()
// after — probe the native library before constructing the WebView and give an actionable message
using System.Runtime.InteropServices;
if (!NativeLibrary.TryLoad("webkitgtk-6.0", out _))
{
throw new DllNotFoundException(
"WebKitGTK could not be found. Please verify that the package " +
"'libwebkitgtk-6.0-4' is installed on the operating system and retry.");
}
var webView = new WebView();
Guard.IsNotNull(webView.WebContext); Defensive patterns
Strategy: try-catch
Validate before calling
using System.Runtime.InteropServices;
bool WebKitGtk6Available() =>
NativeLibrary.TryLoad("webkitgtk-6.0", out _) ||
NativeLibrary.TryLoad("libwebkitgtk-6.0.so.4", out _) ||
NativeLibrary.TryLoad("libwebkitgtk-6.0.4", out _);
if (!WebKitGtk6Available())
{
// show install instructions instead of crashing during WebView construction
return;
} Try / catch
try
{
var webView = new WebView();
Guard.IsNotNull(webView.WebContext);
// ... proceed with CreateWebView body
}
catch (DllNotFoundException ex) when (ex.Message.Contains("WebKitGTK"))
{
// surface the actionable install instruction (libwebkitgtk-6.0-4) to the user
throw;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Unable to find the indicated file.
- Unable to find the indicated file.
- Unable to find the indicated file.
- Unable to find the indicated file.
- Unable to find the indicated file.
AI-assisted analysis of DevToys-app/DevToys@7e12df8448 (2026-08-13).
Data as JSON: /api/errors/50643e1da521ebc0.
Report an issue: GitHub.