openjdk/jdk · error
!!! %s:%i Error: domain %i code %i message: "%s"\n
Error message
!!! %s:%i Error: domain %i code %i message: "%s"\n
What it means
The single error sink for all GLib/GIO GError conditions in the JDK's Wayland screencast portal code (used by java.awt.Robot screen capture under GNOME Wayland). errHandle() prints the failing function and line, the GError domain/code, and the DBus message, then frees the error. Seeing it means a portal DBus call — ScreenCast/RemoteDesktop session setup, SelectSources, Start, or PipeWire stream creation — failed.
Source
Thrown at src/java.desktop/unix/native/libawt_xawt/awt/screencast_portal.c:54
extern volatile bool isGtkMainThread;
extern gboolean isRemoteDesktop;
extern struct ScreenSpace screenSpace;
struct XdgDesktopPortalApi *portal = NULL;
extern int DEBUG_SCREENCAST_ENABLED;
GDBusProxy *getProxy() {
return isRemoteDesktop ? portal->remoteDesktopProxy : portal->screenCastProxy;
}
void errHandle(
GError *error,
const gchar *functionName,
int lineNum
) {
if (error) {
fprintf(stderr, "!!! %s:%i Error: domain %i code %i message: \"%s\"\n",
functionName, lineNum,
error->domain, error->code, error->message);
}
if (error) {
gtk->g_error_free(error);
}
error = NULL;
}
gboolean validateToken(const gchar *token) {
if (!token) {
return FALSE;
}
gboolean isValid = gtk->g_uuid_string_is_valid(token);
if (!isValid) {
DEBUG_SCREENCAST("!!! restore token "
"is not a valid UUID string:\n\"%s\"\n",View on GitHub (pinned to 88dfb74bbe)
Solutions
- Check domain/code in the message: response errorCode 1 = user cancelled, 2 = failed — instruct/allow the user to grant permission
- Ensure xdg-desktop-portal, xdg-desktop-portal-gnome (or -gtk) and pipewire/pipewire-pulse services are installed and running
- Verify the desktop session is a portal-capable Wayland session (echo $XDG_SESSION_TYPE) and not a bare WM without screencast support
- Run the app outside sandboxes or grant it screencast permission (flatpak override / portals config)
Defensive patterns
Strategy: try-catch
Validate before calling
// before Robot capture on Linux, detect Wayland-without-portal capability
if (System.getenv("XDG_SESSION_TYPE", "").equals("wayland") && !portalsAvailable()) {
// fall back to asking the user or running under XWayland
}
static boolean portalsAvailable() {
return Path.of("/usr/share/xdg-desktop-portal/portals").toFile().list().length > 0
&& new ProcessBuilder("systemctl","is-active","--user","pipewire").start().waitFor() == 0;
} Try / catch
try { BufferedImage img = new Robot().createScreenCapture(rect); } catch (AWTException | RuntimeException e) { /* portal denied/failed: show manual-upload fallback */ } Prevention
- Document that Wayland screen capture needs xdg-desktop-portal + PipeWire and a granted permission
- For automation/CI, run under X11/Xvfb where Robot needs no portal
- Cache the portal permission by using a stable app ID so the grant persists
When it happens
Trigger: Robot.createScreenCapture()/createMultiFormatScreenCapture() on Wayland when the org.freedesktop.portal.Desktop request is denied or fails: user dismisses the screencast permission dialog, xdg-desktop-portal(-gnome) is missing or crashed, the compositor lacks screencast support, or the session token times out. The domain/code (e.g. G_IO_ERROR / portal Response errorCode) identifies which.
Common situations: Headless-ish containers or minimal WMs with no portals installed; first-run per-app portal permission denied and not remembered; GNOME version changes breaking portal API; flatpak/sandbox restrictions; PipeWire not running. Robot then throws or returns a failed capture.
Related errors
- Error: Out of memory in ADLC\n
- JVM caught ASAN Error
- VM warning: the use of signal() and sigset() for signal cha
- %s: %d->Invalid message: message status=0x%X while sending s
- %s: %d->internal error: pendingMessageStatus=0x%X, pendingDa
AI-assisted analysis of openjdk/jdk@88dfb74bbe (2026-08-14).
Data as JSON: /api/errors/e5b9ba131267f0e5.
Report an issue: GitHub.